prog.sf 364 B

1234567891011121314151617181920212223
  1. #!/usr/bin/ruby
  2. # Largest prime factor of A001008(n), numerator of n-th harmonic number; a(1) = 1
  3. # https://oeis.org/A308971
  4. include('../../../factordb/auto.sf')
  5. func a(n) is cached {
  6. harmonic(n).nu
  7. }
  8. var fh = File('bfile.txt').open_w
  9. fh.autoflush(true)
  10. for n in (1..10000) {
  11. var row = "#{n} #{gpf(a(n)) || 1}"
  12. say row
  13. fh.say(row)
  14. }
  15. __END__