prog.sf 555 B

123456789101112131415161718
  1. #!/usr/bin/ruby
  2. # a(1) = 1, for n>1 a(n) = largest prime divisor of A062273(n)
  3. # https://oeis.org/A077576
  4. # First 23 terms:
  5. # 1, 23, 19, 263, 823, 678901, 50993, 1279, 211, 150866941, 353594393, 757819, 9012345678901, 213408443, 11904282563, 435503, 21339439879, 7403356241, 13212859242013, 27961, 205126079, 5201061865265117273, 54843374833199
  6. include("../../../factordb/auto.sf")
  7. var nums = File("b062273.txt").open_r.lines.grep{!.match(/^#/)}.map{.nums.last}.grep{defined(_)}
  8. var count = 0
  9. for n in (nums) {
  10. say "#{++count} #{gpf(n)||1}"
  11. }