

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

N. J. A. Sloane, Table of n, a(n) for n = 0..10000


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, n1, 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

Cf. A000720, A127202, A143545, A280985, A282029.
Sequence in context: A195410 A095196 A074828 * A251561 A159193 A118967
Adjacent sequences: A282025 A282026 A282027 * A282029 A282030 A282031


KEYWORD

nonn


AUTHOR

N. J. A. Sloane, Feb 16 2017


STATUS

approved



