Eban numbers: Difference between revisions

Add Julia language
(→‎{{header|Perl 6}}: Add commas, correct order of magnitude, various tweaks)
(Add Julia language)
Line 126:
count = 7999
</pre>
 
=={{header|Julia}}==
<lang Julia>
function iseban(n::Integer)
b, r = divrem(n, oftype(n, 10 ^ 9))
m, r = divrem(r, oftype(n, 10 ^ 6))
t, r = divrem(r, oftype(n, 10 ^ 3))
m, t, r = (30 <= x <= 66 ? x % 10 : x for x in (m, t, r))
return all(in((0, 2, 4, 6)), (b, m, t, r))
end
 
println("eban numbers up to and including 1000:")
println(join(filter(iseban, 1:100), ", "))
 
println("eban numbers between 1000 and 4000 (inclusive):")
println(join(filter(iseban, 1000:4000), ", "))
 
println("eban numbers up to and including 10000: ", count(iseban, 1:10000))
println("eban numbers up to and including 10000: ", count(iseban, 1:100000))
println("eban numbers up to and including 10000: ", count(iseban, 1:1000000))
println("eban numbers up to and including 10000: ", count(iseban, 1:10000000))
println("eban numbers up to and including 10000: ", count(iseban, 1:100000000))
println("eban numbers up to and including 10000: ", count(iseban, 1:1000000000))
</lang>
 
{{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
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
 
eban numbers up to and including 10000: 79
eban numbers up to and including 10000: 399
eban numbers up to and including 10000: 399
eban numbers up to and including 10000: 1599
eban numbers up to and including 10000: 7999
eban numbers up to and including 10000: 7999</pre>
 
=={{header|Perl 6}}==
Anonymous user