A097638 a(n) is the smallest n-digit number m such that 10*m+1, 10*m+3, 10*m+7 & 10*m+9 are primes.
1, 10, 148, 1300, 10111, 100234, 1001395, 10000546, 100002526, 1000005742, 10000000753, 100000012369, 1000000005658, 10000000094572, 100000000006744, 1000000000134649, 10000000000032523, 100000000000043071, 1000000000000213927, 10000000000000256116, 100000000000000008172
Offset: 1
Examples
a(4)=1300 because 13001,13003,13007 & 13009 are primes and 1300 is the smallest 4-digit number with this property.
Links
- G. C. Greubel, Table of n, a(n) for n = 1..50
Programs
-
Magma
F:= func< n,m | IsPrime(10^n +10*m+1) and IsPrime(10^n +10*m+3) and IsPrime(10^n +10*m+7) and IsPrime(10^n +10*m+9) >; function a(n) t:=0; while not F(n,t) do t+:=1; end while; return t+10^(n-1); end function; [a(n): n in [1..15]]; // G. C. Greubel, Aug 11 2023
-
Mathematica
a[n_]:=(For[m=0, !(PrimeQ[10^n+10m+1] && PrimeQ[10^n+10m+3] && PrimeQ[10^n+10m+7] && PrimeQ[10^n+10m+9]), m++ ]; 10^(n-1)+m); Table[a[n], {n, 28}]
-
PARI
isok(m, n) = my(s=10^(n-1)+ m); ispseudoprime(10*s+1) && ispseudoprime(10*s+3) && ispseudoprime(10*s+7) && ispseudoprime(10*s+9); a(n) = my(m=0); while (!isok(m, n), m++); 10^(n-1)+m; \\ Michel Marcus, Aug 09 2023
-
SageMath
def isp(n,m,j): return is_prime(10^n +10*m+j) def f(n,m): return isp(n,m,1) and isp(n,m,3) and isp(n,m,7) and isp(n,m,9) def b(n): k=0 while not f(n,k): k+=1 return k def A097638(n): return b(n) + 10^(n-1) for n in range(1,23): print(A097638(n), end=", ") # G. C. Greubel, Aug 11 2023
Formula
Let f(n, m) be the set of primes 10^n + 10*m + 1, 10^n + 10*m + 3, 10^n + 10*m + 7, and 10^n + 10*m + 9, and let b(n) be the smallest number m that is not in f(n, m). a(n) is then 10^(n-1) + b(n).
Extensions
More terms from Michel Marcus, Aug 09 2023
Comments