A246398 Smallest number of digits that have to be inserted into or prepended to decimal representation of n, to get a prime.
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
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Programs
-
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
Comments