132 Large repunit factors.sf 320 B

1234567891011121314151617181920
  1. #!/usr/bin/ruby
  2. # Daniel "Trizen" Șuteu
  3. # Date: 21 September 2019
  4. # https://github.com/trizen
  5. # https://projecteuler.net/problem=132
  6. # Runtime: 0.763s
  7. # See also:
  8. # https://oeis.org/A178070
  9. const N = 1e9
  10. const C = 40
  11. 7..Inf -> lazy.grep { .is_prime }.grep {|p|
  12. znorder(10, p) `divides` N
  13. }.first(C).sum.say