Task

Write a program which counts up from   1,   displaying each number as the multiplication of its prime factors.

For the purpose of this task,   1   (unity)   may be shown as itself.



Example

      2   is prime,   so it would be shown as itself.

      6   is not prime;   it would be shown as   



2
×
3


{\displaystyle 2\times 3}

.
2144   is not prime;   it would be shown as   



2
×
2
×
2
×
2
×
2
×
67


{\displaystyle 2\times 2\times 2\times 2\times 2\times 67}

.



Related tasks

   prime decomposition
   factors of an integer
   Sieve of Eratosthenes
   primality by trial division
   factors of a Mersenne number
   trial factoring of a Mersenne number
   partition an integer X into N primes


 100  FOR I = 1 TO 20
 110      GOSUB 200"FACTORIAL
 120      PRINT I" = "FA$
 130  NEXT I
 140  END 
 
 200 FA$ = "1"
 210  LET NUM = I
 220  LET O = 5 - (I = 1) * 4
 230  FOR F = 2 TO I
 240      LET M =  INT (NUM / F) * F
 250      IF NUM - M GOTO 300
 260          LET NUM = NUM / F
 270          LET F$ =  STR $(F)
 280         FA$ = FA$ + " X " +  F$
 290          LET F = F - 1
 
 300  NEXT F
 310 FA$ =  MID$ (FA$,O)
 320  RETURN 