OFFSET
0,1
COMMENTS
If a(n) = k is nonzero then a(n+1) = k-1. a(2p) = 0 for p prime.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
MATHEMATICA
a = {}; Do[k = 0; While[ ! PrimeQ[(n + k)/2], k++ ]; AppendTo[a, k]; , {n, 0, 120}]; a (* Ray Chandler, Jan 19 2005 *)
lk[n_]:=Module[{k=If[EvenQ[n], 0, 1]}, While[!PrimeQ[(n+k)/2], k=k+2]; k]; Array[lk, 120, 0] (* Harvey P. Dale, Nov 25 2016 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Amarnath Murthy, Dec 18 2004
EXTENSIONS
Extended by Ray Chandler, Jan 19 2005
STATUS
approved