Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Eban-numbers/Zkl/eban-numbers.zkl
Normal file
28
Task/Eban-numbers/Zkl/eban-numbers.zkl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
rgs:=T( T(2, 1_000, True), // (start,end,print)
|
||||
T(1_000, 4_000, True),
|
||||
T(2, 1e4, False), T(2, 1e5, False), T(2, 1e6, False), T(2, 1e7, False),
|
||||
T(2, 1e8, False), T(2, 1e9, False), // slow and very slow
|
||||
);
|
||||
|
||||
foreach start,end,pr in (rgs){
|
||||
if(start==2) println("eban numbers up to and including %,d:".fmt(end));
|
||||
else println("eban numbers between %,d and %,d (inclusive):".fmt(start,end));
|
||||
|
||||
count:=0;
|
||||
foreach i in ([start..end,2]){
|
||||
b,r := i/100_0000_000, i%1_000_000_000;
|
||||
m,r := r/1_000_000, i%1_000_000;
|
||||
t,r := r/1_000, r%1_000;
|
||||
if(30<=m<=66) m=m%10;
|
||||
if(30<=t<=66) t=t%10;
|
||||
if(30<=r<=66) r=r%10;
|
||||
|
||||
if(magic(b) and magic(m) and magic(t) and magic(r)){
|
||||
if(pr) print(i," ");
|
||||
count+=1;
|
||||
}
|
||||
}
|
||||
if(pr) println();
|
||||
println("count = %,d\n".fmt(count));
|
||||
}
|
||||
fcn magic(z){ z.isEven and z<=6 }
|
||||
Loading…
Add table
Add a link
Reference in a new issue