cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A371509 a(n) is the smallest prime that becomes composite if any single digit of its base-(2n+1) expansion is changed to a different digit (but not to zero).

This page as a plain text file.
%I A371509 #15 Mar 26 2024 16:59:53
%S A371509 2,67,223,2789,701,2423,243367,10513,10909,2114429,68543,181141,
%T A371509 6139219,114493,356479,399946711,22549349,8371249,660040873,12088631,
%U A371509 3352003
%N A371509 a(n) is the smallest prime that becomes composite if any single digit of its base-(2n+1) expansion is changed to a different digit (but not to zero).
%C A371509 Bisection of A323745. a(n) <= A371475(n) with equality for some values of n.
%F A371509 a(n) = A323745(2n+1).
%F A371509 a(n) <= A371475(n).
%o A371509 (Python)
%o A371509 from sympy import isprime, nextprime
%o A371509 from sympy.ntheory import digits
%o A371509 def A371509(n):
%o A371509     if n == 1: return 2
%o A371509     p, r = 5, (n<<1)+1
%o A371509     while True:
%o A371509         m = 1
%o A371509         for j in digits(p,r)[:0:-1]:
%o A371509             for k in range(2-(j&1),r,2):
%o A371509                 if k!=j and isprime(p+(k-j)*m):
%o A371509                     break
%o A371509             else:
%o A371509                 m *= r
%o A371509                 continue
%o A371509             break
%o A371509         else:
%o A371509             return p
%o A371509         p = nextprime(p)
%Y A371509 Cf. A186995, A323745, A371475.
%K A371509 nonn,more,base
%O A371509 1,1
%A A371509 _Chai Wah Wu_, Mar 25 2024