login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A079582 Least k such the distance from k to closest prime = n. 0
2, 1, 9, 26, 93, 118, 119, 120, 531, 532, 897, 1140, 1339, 1340, 1341, 1342, 1343, 1344, 9569, 15702, 15703, 15704, 15705, 19632, 19633, 19634, 19635, 31424, 31425, 31426, 31427, 31428, 31429, 31430, 31431, 31432, 31433, 155958, 155959, 155960, 155961 (list; graph; refs; listen; history; internal format)
OFFSET

0,1

MATHEMATICA

NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; a[n_] := Block[{s = 1}, While[ PrimeQ[s] || Min[s - PrevPrim[s], NextPrim[s] - s] != n, s++ ]; s]; a[0] = 2; Table[a[n], {n, 0, 40}]

PROG

(PARI) a(n)=if(n<0, 0, s=1; while(abs(n-min(abs(precprime(s)-s), abs(nextprime(s)-s)))>0, s++); s)

CROSSREFS

Cf. A051699.

Sequence in context: A178075 A094633 A144244 * A012892 A013071 A155756

Adjacent sequences:  A079579 A079580 A079581 * A079583 A079584 A079585

KEYWORD

nonn

AUTHOR

Benoit Cloitre (benoit7848c(AT)orange.fr), Jan 26 2003

EXTENSIONS

More terms from Robert G. Wilson v (rgwv(AT)rgwv.com), Jan 27 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 16 21:51 EST 2012. Contains 205978 sequences.