108 Diophantine reciprocals I.pl 359 B

123456789101112131415161718192021222324
  1. #!/usr/bin/perl
  2. # Daniel "Trizen" Șuteu
  3. # Date: 17 February 2017
  4. # https://github.com/trizen
  5. # Diophantine reciprocals I
  6. # https://projecteuler.net/problem=108
  7. # Runtime: 0.195s
  8. use 5.010;
  9. use strict;
  10. use integer;
  11. use ntheory qw(divisors);
  12. for (my $n = 1 ; ; ++$n) {
  13. if ((divisors($n * $n) + 1) >> 1 > 1000) {
  14. say $n;
  15. last;
  16. }
  17. }