Factorions: Difference between revisions

Content added Content deleted
(Applesoft BASIC)
(Factorions en FreeBASIC)
Line 350: Line 350:


The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code.
The option to show Fōrmulæ programs and their results is showing images. Unfortunately images cannot be uploaded in Rosetta Code.


=={{header|FreeBASIC}}==
<lang freebasic>Dim As Integer fact(12), suma, m, d, j
fact(0) = 1
For n As Integer = 1 To 11
fact(n) = fact(n-1) * n
Next n
For b As Integer = 9 To 12
Print "Los factoriones para base " & b & " son: "
For i As Integer = 1 To 1499999
suma = 0
j = i
While j > 0
d=j Mod b
suma += fact(d)
j \= b
Wend
If suma = i Then Print i & " ";
Next i
Print : Print
Next b
Sleep</lang>
{{out}}
<pre>
Los factoriones para base 9 son:
1 2 41282

Los factoriones para base 10 son:
1 2 145 40585

Los factoriones para base 11 son:
1 2 26 48 40472

Los factoriones para base 12 son:
1 2
</pre>