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!)
A323137 Largest prime that is both left-truncatable and right-truncatable in base n. 4

%I #34 Mar 13 2019 03:34:04

%S 23,11,67,839,37,1867,173,739397,79,105691,379,37573,647,3389,631,

%T 202715129,211,155863,1283,787817,439,109893629,577,4195880189,1811,

%U 14474071,379,21335388527,2203,1043557,2939,42741029,2767,50764713107,853,65467229,4409,8524002457

%N Largest prime that is both left-truncatable and right-truncatable in base n.

%H Daniel Suteu, <a href="/A323137/b323137.txt">Table of n, a(n) for n = 3..64</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Truncatable_prime">Truncatable prime</a>

%F a(n) <= min(A023107(n), A103443(n)). - _Daniel Suteu_, Feb 24 2019

%e For n = 12: 105691 is 511B7 in base 12. Successively removing the leftmost digit yields the base-12 numbers 11B7, 1B7, B7 and 7. When converted to base 10, these are 2011, 283, 139 and 7, respectively, all primes. Successively removing the rightmost digit yields the base-12 numbers 511B, 511, 51 and 5. When converted to base 10, these are 8807, 733, 61 and 5, respectively, all primes. Since no larger prime with this property in base 12 exists (as proven by Daniel Suteu), a(12) = 105691.

%o (PARI)

%o digitsToNum(d, base) = sum(k=1, #d, base^(k-1) * d[k]);

%o isLeftTruncatable(d, base) = my(ok=1); for(k=1, #d, if(!isprime(digitsToNum(d[1..k], base)), ok=0; break)); ok;

%o generateFromPrefix(p, base) = my(seq = [p]); for(n=1, base-1, my(t=concat(n, p)); if(isprime(digitsToNum(t, base)), seq=concat(seq, select(v -> isLeftTruncatable(v, base), generateFromPrefix(t, base))))); seq;

%o bothTruncatablePrimesInBase(base) = my(t=[]); my(P=primes(primepi(base-1))); for(k=1, #P, t=concat(t, generateFromPrefix([P[k]], base))); vector(#t, k, digitsToNum(t[k], base));

%o a(n) = vecmax(bothTruncatablePrimesInBase(n)); \\ for n>=3; _Daniel Suteu_, Jan 22 2019

%Y Cf. A020994, A023107, A076586, A076623, A103443, A323390, A323396.

%K nonn,base

%O 3,1

%A _Felix Fröhlich_, Jan 05 2019

%E a(17)-a(40) from _Daniel Suteu_, Jan 11 2019

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 25 04:42 EDT 2024. Contains 371964 sequences. (Running on oeis4.)