prog.sf 630 B

12345678910111213141516171819202122
  1. #!/usr/bin/ruby
  2. # Largest prime factor of the n-th Pell number, A000129(n).
  3. # https://oeis.org/A264137
  4. # First several terms of the sequence:
  5. # 2, 5, 3, 29, 7, 13, 17, 197, 41, 5741, 11, 33461, 239, 269, 577, 8297, 199, 179057, 59, 45697, 5741, 982789, 1153, 29201, 33461, 146449, 337, 44560482149, 269, 3272609, 665857, 52734529, 15607, 1800193921, 199, 1101341, 9369319, 4605197, 5521, 1746860020068409
  6. include("../../../factordb/auto.sf")
  7. func a(n) {
  8. lucasU(2, -1, n)
  9. }
  10. var bfile = File("bfile.txt").open_w.autoflush(true)
  11. for n in (2..10000) {
  12. var row = "#{n} #{gpf(a(n))||1}"
  13. say row
  14. bfile.say(row)
  15. }