Eban numbers: Difference between revisions

Content added Content deleted
(Added XPL0 example.)
Line 3,015: Line 3,015:
count = 7999
count = 7999


eban numbers up to and including 1000000000
count = 7999
</pre>

=={{header|XPL0}}==
{{trans|Wren}}
<syntaxhighlight lang "XPL0">include xpllib; \for Print

int Rgs, Rg, Count, I, B, R, M, T;
[Rgs:= [
[2, 1000, true],
[1000, 4000, true],
[2, 10000, false],
[2, 100000, false],
[2, 1000000, false],
[2, 10000000, false],
[2, 100000000, false],
[2, 1000000000, false] ];
for Rg:= 0 to 8-1 do
[if Rgs(Rg,0) = 2 then
Print("eban numbers up to and including %d\n", Rgs(Rg,1))
else
Print("eban numbers between %d and %d (inclusive):\n", Rgs(Rg,0), Rgs(Rg,1));
Count:= 0;
I:= Rgs(Rg,0);
while I <= Rgs(Rg,1) do
[B:= (I/1_000_000_000);
M:= rem(0) / 1_000_000;
T:= rem(0) / 1_000;
R:= rem(0);
if M >= 30 and M <= 66 then M:= rem(M/10);
if T >= 30 and T <= 66 then T:= rem(T/10);
if R >= 30 and R <= 66 then R:= rem(R/10);
if B = 0 or B = 2 or B = 4 or B = 6 then
if M = 0 or M = 2 or M = 4 or M = 6 then
if T = 0 or T = 2 or T = 4 or T = 6 then
if R = 0 or R = 2 or R = 4 or R = 6 then
[if Rgs(Rg,2) then Print("%d ", I);
Count:= Count+1;
];
I:= I+2;
];
if Rgs(Rg,2) then CrLf(0);
Print("count = %d\n", Count);
];
]</syntaxhighlight>
{{out}}
<pre>
eban numbers up to and including 1000
2 4 6 30 32 34 36 40 42 44 46 50 52 54 56 60 62 64 66
count = 19
eban numbers between 1000 and 4000 (inclusive):
2000 2002 2004 2006 2030 2032 2034 2036 2040 2042 2044 2046 2050 2052 2054 2056 2060 2062 2064 2066 4000
count = 21
eban numbers up to and including 10000
count = 79
eban numbers up to and including 100000
count = 399
eban numbers up to and including 1000000
count = 399
eban numbers up to and including 10000000
count = 1599
eban numbers up to and including 100000000
count = 7999
eban numbers up to and including 1000000000
eban numbers up to and including 1000000000
count = 7999
count = 7999