login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A100802 a(n) = least k >= 0 such that (n+k)/2 is prime. 2
4, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 11, 10, 9, 8, 7, 6, 5 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
If a(n) = k is nonzero then a(n+1) = k-1. a(2p) = 0 for p prime.
LINKS
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
Cf. A100803.
Sequence in context: A350493 A327351 A239475 * A022960 A023446 A258447
KEYWORD
nonn,easy
AUTHOR
Amarnath Murthy, Dec 18 2004
EXTENSIONS
Extended by Ray Chandler, Jan 19 2005
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 12 19:05 EDT 2024. Contains 371636 sequences. (Running on oeis4.)