206 Concealed Square.pl 483 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/perl
  2. # Author: Daniel "Trizen" Șuteu
  3. # License: GPLv3
  4. # Date: 24 August 2016
  5. # Website: https://github.com/trizen
  6. # https://projecteuler.net/problem=206
  7. # Runtime: 0.012s
  8. use 5.010;
  9. use strict;
  10. use warnings;
  11. my $n = int sqrt(1020304050607080900); # lower-limit
  12. my $m = int sqrt(1929394959697989990); # upper-limit
  13. for (my $i = $m + (10 - ($m % 10)) ; $i >= $n ; $i -= 10) {
  14. if (($i**2) =~ /^1.2.3.4.5.6.7.8.9.0\z/) {
  15. say $i;
  16. last;
  17. }
  18. }