prog.pl 436 B

1234567891011121314151617181920212223
  1. #!/usr/bin/perl
  2. # Integers n such that the n-th prime divides the n-th Pell number (A000129(n)).
  3. # https://oeis.org/A270493
  4. # Known terms:
  5. # 3, 10, 45, 1710, 308961, 601929, 732202, 2214702, 7626372, 13976550, 21971144, 27575700, 207268867,
  6. use 5.014;
  7. use ntheory qw(:all);
  8. local $| = 1;
  9. my $count = 1;
  10. forprimes {
  11. if ((lucas_sequence($_, 2, -1, $count))[0] == 0) {
  12. print($count, ", ");
  13. }
  14. ++$count;
  15. } 1e11;