Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A079582
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A079582 Least k such the distance from k to closest prime = n. +0
1
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; listen)
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}]

PROGRAM

(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: A083162 A094633 A144244 this_sequence A012892 A013071 A155756

Adjacent sequences: A079579 A079580 A079581 this_sequence 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

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 23 10:40 EST 2009. Contains 167421 sequences.


AT&T Labs Research