Factorions: Difference between revisions

m
→‎{{header|REXX}}: changed program indentations, added whitespace to program and output.
(Added Sidef)
m (→‎{{header|REXX}}: changed program indentations, added whitespace to program and output.)
Line 438:
if lim=='' | lim=="," then lim= 1500000 - 1 /* " " " " " " */
 
do fact=0 forto HIb; !.fact= !(fact) /*use memoization for factorials. */
end /*fact*/
 
do base=LOb to HIb /*process all the required bases. */
@= 1 2 /*initialize the list (@) to null. */
do j=3 for lim-2; $= 0 /*initialize the sum ($) to zero. */
t= j t= j /*define the target (for the sum !'s).*/
do until t==0; d= t // base /*obtain a "digit". */
$= $ + !.d /*add !(d) to sum. */
t= t % base /*get a new target. */
end /*until*/
if $==j then @= @ j /*Good factorial sum? Then add to list.*/
end /*i*/
say
say 'The factorions for base ' right( base, length(HIb) ) " are: " @
end /*base*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 459:
{{out|output|text=  when using the default inputs:}}
<pre>
The factorions for base 9 are: 1 2 41282
 
The factorions for base 10 are: 1 2 145 40585