I wrote a factorialization function here:
Code: (Select All)
Print "Enter range";
Input p: p = Int(p)
If p <= 1 Then End
z = 2
Print " 2= (prime)" ' first prime is 2
Do Until z = p ' display factored numbers
x$ = InKey$
If x$ = Chr$(27) Then
End
End If
z = z + 1
x = z
Print x; "=";
l = 1
q = 0
Do Until x = 1
l = l + 1
Do While x / l = x \ l ' continue to divide number
q = q + 1
If q > 1 Then
Print "*";
End If
Print l;
x = x / l
Loop
If l > Int(z / 2) Then ' test for maximum divisor
Exit Do
End If
If l > Int(Sqr(x)) Then ' test maximum divisor is prime
If q = 0 Then
Exit Do
End If
End If
Loop
If q = 0 Then ' display number is prime
Print " (prime)";
End If
Print
Loop