OFFSET
1,6
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
FORMULA
MATHEMATICA
Module[{k=1}, Table[If[CompositeQ[n], k; k++, 0], {n, 100}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jan 03 2019 *)
PROG
(PARI) a(n)=if(isprime(n), 0, max(0, n-primepi(n)-1)) \\ Charles R Greathouse IV, Aug 21 2011
(Haskell)
import Data.List (unfoldr, genericIndex)
a066246 n = genericIndex a066246_list (n - 1)
a066246_list = unfoldr x (1, 1, a002808_list) where
x (i, z, cs'@(c:cs)) | i == c = Just (z, (i + 1, z + 1, cs))
| i /= c = Just (0, (i + 1, z, cs'))
-- Reinhard Zumkeller, Jan 29 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Dec 09 2001
STATUS
approved