Count in factors: Difference between revisions
Content added Content deleted
m (LET F$ = STR $(F) : FA$ = FA$ + " X " + F$) |
No edit summary |
||
Line 4,852: | Line 4,852: | ||
9999 = 3 x 3 x 11 x 101 |
9999 = 3 x 3 x 11 x 101 |
||
10000 = 2 x 2 x 2 x 2 x 5 x 5 x 5 x 5 |
10000 = 2 x 2 x 2 x 2 x 5 x 5 x 5 x 5 |
||
</pre> |
|||
=={{header|Vlang}}== |
|||
{{trans|go}} |
|||
<lang vlang>fn main() { |
|||
println("1: 1") |
|||
for i := 2; ; i++ { |
|||
print("$i: ") |
|||
mut x := '' |
|||
for n, f := i, 2; n != 1; f++ { |
|||
for m := n % f; m == 0; m = n % f { |
|||
print('$x$f') |
|||
x = "×" |
|||
n /= f |
|||
} |
|||
} |
|||
println('') |
|||
} |
|||
}</lang> |
|||
{{out}} |
|||
<pre> |
|||
1: 1 |
|||
2: 2 |
|||
3: 3 |
|||
4: 2×2 |
|||
5: 5 |
|||
6: 2×3 |
|||
7: 7 |
|||
8: 2×2×2 |
|||
9: 3×3 |
|||
10: 2×5 |
|||
... |
|||
</pre> |
</pre> |
||