Commits

Shlomi Fish committed 3485d81

Started adding Euler 150.

Comments (0)

Files changed (2)

project-euler/150/Euler150.pm

+package Euler150::S;
+
+use strict;
+use warnings;
+
+use integer;
+
+my $t = 0;
+
+sub get
+{
+    $t = ((615949 * $t + 797807) & ((1 << 20)-1));
+    return ($t - (1 << 19));
+}
+
+1;

project-euler/150/test.t

+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+use Euler150;
+
+# TEST
+is (Euler150::S::get(), 273_519, 's_1');
+
+# TEST
+is (Euler150::S::get(), (-153_582), 's_2');
+
+# TEST
+is (Euler150::S::get(), (450_905), 's_3');