login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A077362 Largest n-digit prime whose external digits as well as internal digits form a prime, or 0 if no such number exists. 2

%I #8 May 26 2018 20:05:21

%S 0,0,977,9677,99377,998717,9998777,99999617,999999017,9999996437,

%T 99999997397,999999997277,9999999986477,99999999993317,

%U 999999999997337,9999999999990797,99999999999998837,999999999999995717

%N Largest n-digit prime whose external digits as well as internal digits form a prime, or 0 if no such number exists.

%C Conjecture: no entry is zero for n>2.

%C Conjecture: each term after the first two terms ends with 7. - _Harvey P. Dale_, May 26 2018

%H Harvey P. Dale, <a href="/A077362/b077362.txt">Table of n, a(n) for n = 0..100</a>

%t 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

%t 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 *)

%Y Cf. A069686, A077359, A077360, A077361.

%K base,nonn

%O 0,3

%A _Amarnath Murthy_, Nov 05 2002

%E Corrected and extended by Joshua Albert (jba138(AT)psu.edu), Feb 22 2006

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)