Jump to content

Factorions: Difference between revisions

(julia example)
Line 288:
Factorions in base 12:
1 2</pre>
 
=={{header|Phix}}==
{{trans|C}}
<lang Phix>-- cache factorials from 0 to 11
sequence fact = repeat(1,12)
for n=2 to length(fact) do
fact[n] = fact[n-1]*(n-1)
end for
 
for b=9 to 12 do
printf(1,"The factorions for base %d are:\n", b)
for i=1 to 1499999 do
atom total = 0, j = i, d
while j>0 do
d = remainder(j,b)
total += fact[d+1]
j = floor(j/b)
end while
if total==i then printf(1,"%d ", i) end if
end for
printf(1,"\n\n")
end for</lang>
{{out}}
<pre>
The factorions for base 9 are:
1 2 41282
 
The factorions for base 10 are:
1 2 145 40585
 
The factorions for base 11 are:
1 2 26 48 40472
 
The factorions for base 12 are:
1 2
</pre>
 
=={{header|REXX}}==
7,824

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.