login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A246398
Smallest number of digits that have to be inserted into or prepended to decimal representation of n, to get a prime.
1
2, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 2, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 2, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 2, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 2, 1
OFFSET
0,1
COMMENTS
a(n) = 0 iff n is a prime number, a(A000040(n)) = 0;
a(n) = A055642(A062584(n)) - A055642(n).
LINKS
PROG
(Haskell)
a246398 n = a246398_list !! n
a246398_list = f 0 $ map show a000040_list where
f x pss = (length ps - length xs) :
f (x + 1) (dropWhile (== xs) pss)
where ps = head [qs | qs <- pss, isin xs qs]; xs = show x
isin [] _ = True
isin _ [] = False
isin (u:us) vs = not (null ws) && isin us ws
where ws = dropWhile (/= u) vs
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Nov 13 2014
STATUS
approved