A097639 a(n) is the smallest number m such that for the n-digit number s=10^(n-1)+ m, 10*s+1, 10*s+3, 10*s+7 and 10*s+9 are primes.
0, 0, 48, 300, 111, 234, 1395, 546, 2526, 5742, 753, 12369, 5658, 94572, 6744, 134649, 32523, 43071, 213927, 256116, 8172, 431904, 57138, 433125, 123225, 711447, 318501, 40758, 150063, 184602, 134661, 377778, 129048, 504678, 88113, 3174738
Offset: 1
Examples
a(4)=300 because 10(10^3+300)+ 1, 10(10^3+300)+ 3, 10(10^3+300)+ 7 and 10(10^3+300)+1, are primes and 300 is the smallest number with this property.
Programs
-
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++ ];m);Table[a[n], {n, 43}] Table[Module[{m=0,s=10^n},While[AnyTrue[10(s+m)+{1,3,7,9},CompositeQ],m++];m],{n,0,35}] (* Harvey P. Dale, Sep 19 2022 *)
-
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++); m; \\ Michel Marcus, Aug 09 2023
Formula
a(n) = A097638(n) - 10^(n-1).
Comments