Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,33 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Roman_Numeral_Test is
function To_Roman (Number : Positive) return String is
subtype Digit is Integer range 0..9;
function Roman (Figure : Digit; I, V, X : Character) return String is
begin
case Figure is
when 0 => return "";
when 1 => return "" & I;
when 2 => return I & I;
when 3 => return I & I & I;
when 4 => return I & V;
when 5 => return "" & V;
when 6 => return V & I;
when 7 => return V & I & I;
when 8 => return V & I & I & I;
when 9 => return I & X;
end case;
end Roman;
begin
pragma Assert (Number >= 1 and Number < 4000);
return
Roman (Number / 1000, 'M', ' ', ' ') &
Roman (Number / 100 mod 10, 'C', 'D', 'M') &
Roman (Number / 10 mod 10, 'X', 'L', 'C') &
Roman (Number mod 10, 'I', 'V', 'X');
end To_Roman;
begin
Put_Line (To_Roman (1999));
Put_Line (To_Roman (25));
Put_Line (To_Roman (944));
end Roman_Numeral_Test;

View file

@ -1,5 +1,5 @@
nums: [[1000 "M"] [900 "CM"] [500 "D"] [400 "CD"] [100 "C"] [90 "XC"]
[50 "L"] [40 "XL"] [10 "X"] [9 "IX"] [5 "V"] [4 "IV"] [1 "I"])
[50 "L"] [40 "XL"] [10 "X"] [9 "IX"] [5 "V"] [4 "IV"] [1 "I"]]
toRoman: function [x][
ret: ""

View file

@ -1,24 +0,0 @@
(defun c:roman() (romanNumber (getint "\n Enter number > "))
(defun romanNumber (n / uni dec hun tho nstr strlist nlist rom)
(if (and (> n 0) (<= n 3999))
(progn
(setq
UNI (list "" "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX")
DEC (list "" "X" "XX" "XXX" "XL" "L" "LX" "LXX" "LXXX" "XC")
HUN (list "" "C" "CC" "CCC" "CD" "D" "DC" "DCC" "DCCC" "CM")
THO (list "" "M" "MM" "MMM")
nstr (itoa n)
)
(while (> (strlen nstr) 0) (setq strlist (append strlist (list (substr nstr 1 1))) nstr (substr nstr 2 (strlen nstr))))
(setq nlist (mapcar 'atoi strlist))
(cond
((> n 999)(setq rom(strcat(nth (car nlist) THO)(nth (cadr nlist) HUN)(nth (caddr nlist) DEC) (nth (last nlist)UNI ))))
((and (> n 99)(<= n 999))(setq rom(strcat (nth (car nlist) HUN)(nth (cadr nlist) DEC) (nth (last nlist)UNI ))))
((and (> n 9)(<= n 99))(setq rom(strcat (nth (car nlist) DEC) (nth (last nlist)UNI ))))
((<= n 9)(setq rom(nth (last nlist)UNI)))
)
)
(princ "\nNumber out of range!")
)
rom
)

View file

@ -1,53 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. TOROMAN.
DATA DIVISION.
working-storage section.
01 ws-number pic 9(4) value 0.
01 ws-save-number pic 9(4).
01 ws-tbl-def.
03 filler pic x(7) value '1000M '.
03 filler pic x(7) value '0900CM '.
03 filler pic x(7) value '0500D '.
03 filler pic x(7) value '0400CD '.
03 filler pic x(7) value '0100C '.
03 filler pic x(7) value '0090XC '.
03 filler pic x(7) value '0050L '.
03 filler pic x(7) value '0040XL '.
03 filler pic x(7) value '0010X '.
03 filler pic x(7) value '0009IX '.
03 filler pic x(7) value '0005V '.
03 filler pic x(7) value '0004IV '.
03 filler pic x(7) value '0001I '.
01 filler redefines ws-tbl-def.
03 filler occurs 13 times indexed by rx.
05 ws-tbl-divisor pic 9(4).
05 ws-tbl-roman-ch pic x(1) occurs 3 times indexed by cx.
01 ocx pic 99.
01 ws-roman.
03 ws-roman-ch pic x(1) occurs 16 times.
PROCEDURE DIVISION.
accept ws-number
perform
until ws-number = 0
move ws-number to ws-save-number
if ws-number > 0 and ws-number < 4000
initialize ws-roman
move 0 to ocx
perform varying rx from 1 by +1
until ws-number = 0
perform until ws-number < ws-tbl-divisor (rx)
perform varying cx from 1 by +1
until ws-tbl-roman-ch (rx, cx) = spaces
compute ocx = ocx + 1
move ws-tbl-roman-ch (rx, cx) to ws-roman-ch (ocx)
end-perform
compute ws-number = ws-number - ws-tbl-divisor (rx)
end-perform
end-perform
display 'inp=' ws-save-number ' roman=' ws-roman
else
display 'inp=' ws-save-number ' invalid'
end-if
accept ws-number
end-perform
.

View file

@ -24,9 +24,9 @@ extension op
= RomanDictionary.accumulate(new StringWriter("I", self), (m,kv => m.replace(new StringWriter("I",kv.Key).Value, kv.Value)));
}
public program()
public Program()
{
console.printLine("1990 : ", 1990.toRoman());
console.printLine("2008 : ", 2008.toRoman());
console.printLine("1666 : ", 1666.toRoman())
Console.printLine("1990 : ", 1990.toRoman());
Console.printLine("2008 : ", 2008.toRoman());
Console.printLine("1666 : ", 1666.toRoman())
}

View file

@ -1,17 +0,0 @@
(defun ar2ro (AN)
"Translate from arabic number AN to roman number.
For example, (ar2ro 1666) returns (M D C L X V I)."
(cond
((>= AN 1000) (cons 'M (ar2ro (- AN 1000))))
((>= AN 900) (cons 'C (cons 'M (ar2ro (- AN 900)))))
((>= AN 500) (cons 'D (ar2ro (- AN 500))))
((>= AN 400) (cons 'C (cons 'D (ar2ro (- AN 400)))))
((>= AN 100) (cons 'C (ar2ro (- AN 100))))
((>= AN 90) (cons 'X (cons 'C (ar2ro (- AN 90)))))
((>= AN 50) (cons 'L (ar2ro (- AN 50))))
((>= AN 40) (cons 'X (cons 'L (ar2ro (- AN 40)))))
((>= AN 10) (cons 'X (ar2ro (- AN 10))))
((>= AN 5) (cons 'V (ar2ro (- AN 5))))
((>= AN 4) (cons 'I (cons 'V (ar2ro (- AN 4)))))
((>= AN 1) (cons 'I (ar2ro (- AN 1))))
((= AN 0) nil)))

View file

@ -1,18 +0,0 @@
constant arabic = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 }
constant roman = {"M", "CM", "D","CD", "C","XC","L","XL","X","IX","V","IV","I"}
function toRoman(integer val)
sequence result
result = ""
for i = 1 to 13 do
while val >= arabic[i] do
result &= roman[i]
val -= arabic[i]
end while
end for
return result
end function
printf(1,"%d = %s\n",{2009,toRoman(2009)})
printf(1,"%d = %s\n",{1666,toRoman(1666)})
printf(1,"%d = %s\n",{3888,toRoman(3888)})

View file

@ -1,37 +0,0 @@
Filter ToRoman {
$output = ''
if ($_ -ge 4000) {
throw 'Number too high'
}
$current = 1000
$subtractor = 'M'
$whole = $False
$decimal = $_
'C','D','X','L','I','V',' ' `
| %{
$divisor = $current
if ($whole = !$whole) {
$current /= 10
$subtractor = $_ + $subtractor[0]
$_ = $subtractor[1]
}
else {
$divisor *= 5
$subtractor = $subtractor[0] + $_
}
$multiple = [Math]::floor($decimal / $divisor)
if ($multiple) {
$output += [string]$_ * $multiple
$decimal %= $divisor
}
if ($decimal -ge ($divisor -= $current)) {
$output += $subtractor
$decimal -= $divisor
}
}
$output
}

View file

@ -1 +0,0 @@
19,4,0,2479,3001 | ToRoman