Commits

Shlomi Fish committed 1abf3f6

Optimisation.

  • Participants
  • Parent commits 1a26be3

Comments (0)

Files changed (2)

File project-euler/148/Makefile

 all: dump.txt
 
 dump.txt: print-row.pl
-	( for i in $$(seq 1 147) ; do perl print-row.pl "$$i" ; done) > $@
+	perl print-row.pl $$(seq 1 147) > $@

File project-euler/148/print-row.pl

     return fact($n) / (fact($n-$k) * fact($k));
 }
 
-my $n = shift(@ARGV);
-
-print join(' ', map { +(nCr($n-1, $_) % 7 == 0 ) ? 'Y' : 'N' } (1 .. $n-2)), "\n";
+foreach my $n (@ARGV)
+{
+    print join(' ', map { +(nCr($n-1, $_) % 7 == 0 ) ? 'Y' : 'N' } (1 .. $n-2)), "\n";
+}