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

%I #24 Jan 20 2023 21:54:52

%S 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,

%T 21,23,24,58,25,62,27,28,29,30,31,74,32,33,35,82,36,86,37,39,40,94,41,

%U 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

%N If n is prime then a(n) = 2n, otherwise a(n) is the smallest missing number.

%H N. J. A. Sloane, <a href="/A282028/b282028.txt">Table of n, a(n) for n = 0..10000</a>

%F If n is prime, a(n) = 2n, and these points line on the upper straight line in the graph.

%F 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.

%F 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).

%F This implies that if n is not a prime, a(n) = n*(1 - 1/(2*log(n)) + o(1/log(n))).

%F These are the points on the lower line, which is not straight but has slope roughly equal to 1.

%o (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

%Y Cf. A000720, A127202, A143545, A280985, A282029.

%K nonn

%O 0,3

%A _N. J. A. Sloane_, Feb 16 2017

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 September 18 02:28 EDT 2024. Contains 375995 sequences. (Running on oeis4.)