prog.pl 547 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/perl
  2. use 5.014;
  3. #use ntheory qw(forprimes is_prime vecall prime_iterator lcm divisor_sum divisors);
  4. use Math::Prime::Util::GMP qw(is_prob_prime);
  5. # https://oeis.org/draft/A306661
  6. # a(8)-a(9) from ~~~~
  7. # Found: 4254
  8. use Math::GMPz;
  9. my $ten = Math::GMPz->new(10);
  10. my $from = 5246;
  11. foreach my $k($from..1e9) {
  12. say "Testking: $k";
  13. if (is_prob_prime(($ten**($k+3) + 111) * $ten**($k+1) + 1)) {
  14. say $k;
  15. if ($k > $from) {
  16. die "Found new term: $k";
  17. }
  18. }
  19. #(10^(k+3)+111)*10^(k+1)+1
  20. }