Skip to main content
edited body
Source Link
Andreas Louv
  • 1.7k
  • 13
  • 25

Perl, 17 + 3 = 20 bytes

$p=$_*=$==1+$p/$_ 

Requires -p and -l flags:

$ perl -plE'$p=$_*=$==1+$pple'$p=$_*=$==1+$p/$_' <<< $'15\n8\n12\n47\n22\n15\n4\n66\n72\n15\n3\n4' 15 16 24 47 66 75 76 132 144 150 153 156 

Explanation:

# '-p' reads each line into $_ and auto print # '-l' chomp off newline on input and also inserts a new line when printing # When assigning a number to `$=` it will automatic be truncated to an integer # * Added newlines for each assignment $p= $_*= $== 1+$p/$_ 

Perl, 17 + 3 = 20 bytes

$p=$_*=$==1+$p/$_ 

Requires -p and -l flags:

$ perl -plE'$p=$_*=$==1+$p/$_' <<< $'15\n8\n12\n47\n22\n15\n4\n66\n72\n15\n3\n4' 15 16 24 47 66 75 76 132 144 150 153 156 

Explanation:

# '-p' reads each line into $_ and auto print # '-l' chomp off newline on input and also inserts a new line when printing # When assigning a number to `$=` it will automatic be truncated to an integer # * Added newlines for each assignment $p= $_*= $== 1+$p/$_ 

Perl, 17 + 3 = 20 bytes

$p=$_*=$==1+$p/$_ 

Requires -p and -l flags:

$ perl -ple'$p=$_*=$==1+$p/$_' <<< $'15\n8\n12\n47\n22\n15\n4\n66\n72\n15\n3\n4' 15 16 24 47 66 75 76 132 144 150 153 156 

Explanation:

# '-p' reads each line into $_ and auto print # '-l' chomp off newline on input and also inserts a new line when printing # When assigning a number to `$=` it will automatic be truncated to an integer # * Added newlines for each assignment $p= $_*= $== 1+$p/$_ 
Source Link
Andreas Louv
  • 1.7k
  • 13
  • 25

Perl, 17 + 3 = 20 bytes

$p=$_*=$==1+$p/$_ 

Requires -p and -l flags:

$ perl -plE'$p=$_*=$==1+$p/$_' <<< $'15\n8\n12\n47\n22\n15\n4\n66\n72\n15\n3\n4' 15 16 24 47 66 75 76 132 144 150 153 156 

Explanation:

# '-p' reads each line into $_ and auto print # '-l' chomp off newline on input and also inserts a new line when printing # When assigning a number to `$=` it will automatic be truncated to an integer # * Added newlines for each assignment $p= $_*= $== 1+$p/$_