2017-12-31T11:07:45

prime numbers decomposition; Perl one-liner

jozef@ant:~$ N=200408 perl -E '$x=$ENV{N}; for ($i=2; $i <= $x; $i++) { if ($x % $i == 0) { say $i; $x = $x / $i; $i = $i-1; } }' 2 2 2 13 41 47 jozef@ant:~$ perl -lE 'say 2*2*2*13*41*47' 200408 jozef@ant:~$ N=251930 perl -E '$x=$ENV{N}; for ($i=2; $i <= $x; $i++) { if ($x % $i == 0) { say $i; $x = $x / $i; $i = $i-1; } }' 2 5 7 59 61 jozef@ant:~$ perl -lE 'say 2*5*7*59*61' 251930 jozef@ant:~$ N=4810635094583748086 perl -E '$x=$ENV{N}; for ($i=2; $i <= $x; $i++) { if ($x % $i == 0) { say $i; $x = $x / $i; $i = $i-1; } }' 2 29 37 47 107 127 227 229 251 269 jozef@ant:~$ perl -E 'say 2*29*37*47*107*127*227*229*251*269' 4810635094583748086

comments powered by Disqus