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!)
A240959 Smallest number that contains the first n primes as substrings. Substrings can go from left to right or right to left. 3
2, 23, 235, 2357, 112357, 113257, 231175, 11325719, 11325719, 11329175, 11329175, 113291735, 3117329145, 11329143715, 411329173475, 3114329173547, 31143291735947, 1132914347167359, 1132914347167359, 1132914347167359, 1132914347167359, 11329143471673597 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
In this version substrings can go from left to right or right to left. The version that only allows substrings to go from left to right is A054261.
LINKS
Dmitry Kamenetsky, Results for larger n.
FORMULA
a(n) = A054261(n) for n=1 to 6.
EXAMPLE
a(7) = 231175, because 231175 is the smallest number that contains the first 7 primes as substrings: 2, 3, 5, 7, 11 and 13. Note that number 13 is contained from right to left.
PROG
(PARI) allss(d, ss, nbc) = {for (i=1, nbc, for (j=1, #d -i +1, subd = []; subd = concat(subd, d[j]); for (k=1, i-1, subd = concat(subd, d[j+k]); ); ss = vecsort(concat(ss, subst(Pol(subd), x, 10)), , 8); ); ); return (ss); }
isoks(k, n, vp) = {nbc = #Str(prime(n)); d = digits(k); sd = vecsort(d, , 8); for (j=1, #vp, if (!vecsearch(sd, vp[j]), return(0)); ); ss = []; if (#d < nbc, return(0)); ss = allss(d, ss, nbc); rd = vector(#d, i, d[#d - i +1]); ss = allss(rd, ss, nbc); for (i=1, n, if (! vecsearch (ss, prime(i)), return (0)); ); return (1); }
a(n) = {vp = []; for (i=1, n, dp = digits(prime(i)); for (k=1, #dp, vp = vecsort(concat(vp, dp[k]), , 8); ); ); k = subst(Pol(vp), x, 10); while (!isoks(k, n, vp), k++); k; } \\ Michel Marcus, Aug 28 2014
CROSSREFS
Cf. A054261.
Sequence in context: A287353 A091762 A309706 * A054261 A019518 A048677
KEYWORD
nonn,base
AUTHOR
Dmitry Kamenetsky, Aug 04 2014
EXTENSIONS
The author says he is not 100% certain that the later terms are correct, and would appreciate an independent verification. - N. J. A. Sloane, Sep 04 2014
STATUS
approved

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