108 Diophantine reciprocals I.sf 313 B

1234567891011121314151617181920
  1. #!/usr/bin/ruby
  2. # Daniel "Trizen" Șuteu
  3. # Date: 15 May 2021
  4. # https://github.com/trizen
  5. # Diophantine reciprocals I
  6. # https://projecteuler.net/problem=108
  7. # See also:
  8. # https://oeis.org/A018892
  9. # Runtime: 2.468s (previously: 3.913s)
  10. var N = 1000
  11. 1..Inf -> first {|n|
  12. (sigma0(n*n) + 1) > 2*N
  13. } -> say