OFFSET
1,2
COMMENTS
Comments from N. J. A. Sloane, Nov 02 2020: (Start)
Alternatively, this is the lexicographically earliest infinite sequence of distinct positive numbers such that every prime is followed by its double.
Theorem: This is a permutation of the positive integers.
Proof. Sequence is clearly infinite, so for any k there is a number N_0(k) such that n >= N_0(k) implies a(n) > k.
Suppose m is missing. Consider a(n) for n = N_0(m). Then a(n) must be a prime p (otherwise it would have been m, which is missing), a(n+1) = 2*p, and a(n+2) = m, a contradiction. QED.
(End)
Alternative definition: a(1,2) = 1,2. Let P(k) = rad(a(1)*a(2)*...*a(k)), then for n > 2, a(n) = P(n)/P(n-1), where rad is A007947. - David James Sycamore, Jan 27 2024
LINKS
N. J. A. Sloane, Table of n, a(n) for n = 1..75000
FORMULA
There is an explicit formula for the n-th term of the inverse permutation: see A338362.
The graph: Numbers appear in the sequence in their natural order, except when interrupted by the appearance of primes. Suppose a(n)=x, where x is neither a prime nor twice a prime. Then if p is a prime in the range x/2 < p < x, 2p appears in the sequence between p and p+1. Therefore we have the identity
n = x + pi(x) - pi(x/2). ... (1)
If a(n) = x = a prime, then (1) is replaced by
n = x + pi(x) - pi(x/2) - 1. ... (2)
If a(n) = x = twice a prime then
n = x/2 + pi(x/2) - pi(x/4). ... (3)
These equations imply that the lower line in the graph of the sequence is
x approx= n(1 - 1/(2*log n)) ... (4)
while the upper line is
x approx= 2n(1 - 1/(2*log n)). ... (5)
a(2*n-1 + A369610(n)) = prime(n). - David James Sycamore, Jan 27 2024
EXAMPLE
The offset is 1. What is a(1)? It is the smallest missing positive number, which is 1. Similarly, a(2)=2.
What is a(3)? Since the previous term was the prime 2, a(3) = 4.
And so on.
MAPLE
a:=[1];
H:=Array(1..1000, 0); MMM:=1000;
H[1]:=1; smn:=2; t:=2;
for n from 2 to 100 do
if t=smn then a:=[op(a), t]; H[t]:=1;
if isprime(t) then a:=[op(a), 2*t]; H[2*t]:=1; fi;
t:=t+1;
# update smallest missing number smn
for i from smn+1 to MMM do if H[i]=0 then smn:=i; break; fi; od;
else t:=t+1;
fi;
od:
a;
MATHEMATICA
Module[{nmax = 100, smn = 1}, Nest[Append[#, If[PrimeQ[Last[#]], 2*Last[#], While[MemberQ[#, ++smn]]; smn]]&, {1}, nmax-1]] (* Paolo Xausa, Feb 12 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Mar 08 2017
EXTENSIONS
Entry revised by N. J. A. Sloane, Nov 03 2020
STATUS
approved