summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--206.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/206.pl b/206.pl
new file mode 100644
index 0000000..e36a1c5
--- /dev/null
+++ b/206.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.014;
+
+use bigint;
+
+for my $first (0..9) {
+ for my $second (0..9) {
+ my $min = 1020304050607080900 + $first * 100000000000000000 + $second * 1000000000000000;
+ my $max = 1020394959697989990 + $first * 100000000000000000 + $second * 1000000000000000;
+ my $guess = 10 + 10 * int(sqrt($min) / 10);
+
+ while (1) {
+ my $square = $guess**2;
+ say $guess and exit if $square =~ /^1.2.3.4.5.6.7.8.9.0$/;
+ $guess += 10;
+ last if $square > $max;
+ }
+ }
+}