OFFSET
1,2
COMMENTS
a(n) is the smallest n-digit term of A007811. a(50)=10^49+10718757, can you find a(100)?
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..50
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).
EXAMPLE
a(4)=1300 because 13001,13003,13007 & 13009 are primes and 1300 is the smallest 4-digit number with this property.
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}]
PROG
(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
(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
(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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Farideh Firoozbakht, Aug 18 2004
EXTENSIONS
More terms from Michel Marcus, Aug 09 2023
STATUS
approved