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.

A172514 First prime not the middle of a prime two digits longer in base n.

This page as a plain text file.
%I A172514 #38 Jul 12 2023 10:12:06
%S A172514 3,7,19,97,823,3499,2777,6827,2437,21523,300299,446273,339769,1168523,
%T A172514 14117417,29227421,14160061,78521987,161187707,1200085823,2125209127,
%U A172514 1369430897,56378083771,26054006611,76375900241,290373503549,640442460709
%N A172514 First prime not the middle of a prime two digits longer in base n.
%e A172514 In base n=10, 2437 is the least prime such that all numbers of the form x2437y where x and y are digits [1..9] are composite, so a(10)=2437.
%o A172514 (PARI) isok(p, n) = my(m=logint(p,n)+1); for (x=1, n-1, my(q = x*n^m+p); for (y=1, n-1, if (isprime(n*q+y), return (0)););); return(1);
%o A172514 a(n) = my(p=2); while (!isok(p, n), p=nextprime(p+1)); p; \\ _Michel Marcus_, Sep 04 2022
%o A172514 (Python)
%o A172514 from sympy import isprime, nextprime
%o A172514 def digits(n, b):
%o A172514     c = 0
%o A172514     while n >= b: n //= b; c += 1
%o A172514     return c + 1
%o A172514 def a(n):
%o A172514     p = 2
%o A172514     while True:
%o A172514         d, p1, found = digits(p, n), n*p, True
%o A172514         for f in range(n**(d+1), n**(d+2), n**(d+1)):
%o A172514             for e in range(0, n, 2) if (f+p1)%2 else range(1, n, 2):
%o A172514                 if isprime(f + p1 + e): found = False; break
%o A172514             if not found: break
%o A172514         if found: return p
%o A172514         p = nextprime(p)
%o A172514 print([a(n) for n in range(2, 15)]) # _Michael S. Branicky_, Sep 05 2022
%Y A172514 Cf. A032734 (in base 10 and not limited to primes).
%Y A172514 Cf. A247593, A247699.
%K A172514 nonn,base,more
%O A172514 2,1
%A A172514 _James G. Merickel_, Feb 05 2010
%E A172514 a(24)-a(26) added by _James G. Merickel_, Sep 22 2014
%E A172514 a(26) removed (see user talk page) by _Bill McEachen_, Sep 03 2022
%E A172514 a(26) from _Michael S. Branicky_, Sep 20 2022
%E A172514 a(27) from _Michael S. Branicky_, Jul 10 2023
%E A172514 a(28) from _Michael S. Branicky_, Jul 12 2023