|
|
A077362
|
|
Largest n-digit prime whose external digits as well as internal digits form a prime, or 0 if no such number exists.
|
|
2
|
|
|
0, 0, 977, 9677, 99377, 998717, 9998777, 99999617, 999999017, 9999996437, 99999997397, 999999997277, 9999999986477, 99999999993317, 999999999997337, 9999999999990797, 99999999999998837, 999999999999995717
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Conjecture: no entry is zero for n>2.
Conjecture: each term after the first two terms ends with 7. - Harvey P. Dale, May 26 2018
|
|
LINKS
|
|
|
MATHEMATICA
|
LastDigit[n_] := n - 10*Floor[n/10]; FirstDigit[n_] := Floor[n/(10^(Ceiling[Log[10, n]] - 1))]; MiddleDigits[n_] := Floor[(n - Floor[n/(10^(Ceiling[Log[10, n]] - 1))]*10^(Ceiling[Log[10, n]] - 1))/10]; IntExtPrimeTest2[n_] := TrueQ[(Boole[PrimeQ[FirstDigit[n]*10 + LastDigit[ n]]] + Boole[PrimeQ[MiddleDigits[n]]] + Boole[PrimeQ[n]]) == 3]; finder[digits_] := (maxj = 10^digits; For[j = maxj, IntExtPrimeTest2[j] == False, j-- ]; Print[j]); Do[finder[n], {n, 3, 25}] - Joshua Albert (jba138(AT)psu.edu), Feb 22 2006
eidQ[n_]:=Module[{idn=IntegerDigits[n]}, AllTrue[{FromDigits[Join[ {idn[[1]]}, {idn[[-1]]}]], FromDigits[Most[Rest[idn]]]}, PrimeQ]]; Join[ {0, 0}, Table[Module[{np=NextPrime[10^n-1, -1]}, While[ !eidQ[np], np = NextPrime[ np, -1]]; np], {n, 3, 18}]] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, May 26 2018 *)
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
Corrected and extended by Joshua Albert (jba138(AT)psu.edu), Feb 22 2006
|
|
STATUS
|
approved
|
|
|
|