login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
2
1, 10, 148, 1300, 10111, 100234, 1001395, 10000546, 100002526, 1000005742, 10000000753, 100000012369, 1000000005658, 10000000094572, 100000000006744, 1000000000134649, 10000000000032523, 100000000000043071, 1000000000000213927, 10000000000000256116, 100000000000000008172
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
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
Sequence in context: A055761 A295524 A095889 * A178084 A098270 A262738
KEYWORD
base,nonn
AUTHOR
Farideh Firoozbakht, Aug 18 2004
EXTENSIONS
More terms from Michel Marcus, Aug 09 2023
STATUS
approved