A340115 Largest prime whose decimal expansion consists of the concatenation of a 1-digit cube, a 2-digit cube, a 3-digit cube, ..., and an n-digit cube, or 0 if there is no such prime.
0, 827, 164729, 8642164913, 864729685979507, 864729926197336531441, 8647299261973369702994826809, 864729926197336970299980034443986977, 864729926197336970299993837599897344909853209, 8647299261973369702999938375998973449970029998036054027
Offset: 1
Examples
a(1) = 0 because no 1-digit cube {0, 1, 8} is prime. a(2) = 827 because 827 is prime and is the concatenation of 8 = 2^3 and 27 = 3^3. a(3) = 164729 because 827343, 827729, 864343 and 864729 are not primes and 164729, concatenation of 1 = 1^3, 64 = 4^3 and 729 = 9^3 is prime.
Links
- M. F. Hasler, Table of n, a(n) for n = 1..44 (all terms < 10^1000), Dec 31 2020
Crossrefs
Programs
-
PARI
A340115(n)=forvec(v=vector(n,k,-[sqrtnint(10^k-1,3),ceil(10^((k-1)/3))]),ispseudoprime(n=eval(concat([Str(-k^3)|k<-v])))&&return(n)) \\ M. F. Hasler, Dec 31 2020
-
Python
from sympy import isprime from itertools import product def a(n): cubes = [str(k**3) for k in range(1, int((10**n)**(1/3))+2)] revcbs = [[k3 for k3 in cubes if len(k3)==i+1][::-1] for i in range(n)] for t in product(*revcbs): intt = int("".join(t)) if isprime(intt): return intt return 0 print([a(n) for n in range(1, 11)]) # Michael S. Branicky, Dec 28 2020
Extensions
a(4)-a(10) from Michael S. Branicky, Dec 28 2020
Comments