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!)
A282028 If n is prime then a(n) = 2n, otherwise a(n) is the smallest missing number. 3
0, 1, 4, 6, 2, 10, 3, 14, 5, 7, 8, 22, 9, 26, 11, 12, 13, 34, 15, 38, 16, 17, 18, 46, 19, 20, 21, 23, 24, 58, 25, 62, 27, 28, 29, 30, 31, 74, 32, 33, 35, 82, 36, 86, 37, 39, 40, 94, 41, 42, 43, 44, 45, 106, 47, 48, 49, 50, 51, 118, 52, 122, 53, 54, 55, 56, 57, 134, 59, 60, 61, 142, 63, 146, 64, 65 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
If n is prime, a(n) = 2n, and these points line on the upper straight line in the graph.
If n is not a prime, after n terms we have seen all the numbers from 0 through a(n) and also the doubles of all the primes p in the range a(n)/2 < p < n.
So n = a(n) + pi(n) - pi(a(n)/2). In other words, if n is not a prime then a(n) is the unique solution to a(n) - pi(a(n)/2) = n - pi(n).
This implies that if n is not a prime, a(n) = n*(1 - 1/(2*log(n)) + o(1/log(n))).
These are the points on the lower line, which is not straight but has slope roughly equal to 1.
PROG
(PARI) first(n) = { my(res = vector(n), i = 1); for(x=1, n-1, if(isprime(x), res[x+1] = 2*x, if(setsearch(Set(res), i), i++); res[x+1]=i; i++)); res; } \\ Iain Fox, Nov 18 2017
CROSSREFS
Sequence in context: A195410 A095196 A074828 * A251561 A159193 A118967
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 16 2017
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 March 28 20:05 EDT 2024. Contains 371254 sequences. (Running on oeis4.)