login
Smallest number of digits that have to be inserted into or prepended to decimal representation of n, to get a prime.
1

%I #7 Nov 13 2014 23:57:14

%S 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,

%T 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,

%U 1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,0,2,1

%N Smallest number of digits that have to be inserted into or prepended to decimal representation of n, to get a prime.

%C a(n) = 0 iff n is a prime number, a(A000040(n)) = 0;

%C a(n) = A055642(A062584(n)) - A055642(n).

%H Reinhard Zumkeller, <a href="/A246398/b246398.txt">Table of n, a(n) for n = 0..10000</a>

%o (Haskell)

%o a246398 n = a246398_list !! n

%o a246398_list = f 0 $ map show a000040_list where

%o f x pss = (length ps - length xs) :

%o f (x + 1) (dropWhile (== xs) pss)

%o where ps = head [qs | qs <- pss, isin xs qs]; xs = show x

%o isin [] _ = True

%o isin _ [] = False

%o isin (u:us) vs = not (null ws) && isin us ws

%o where ws = dropWhile (/= u) vs

%Y Cf. A000040, A055642, A062584, A068164.

%K nonn,base

%O 0,1

%A _Reinhard Zumkeller_, Nov 13 2014