OFFSET
1,2
COMMENTS
From Eric Angelini, Feb 11 2015: (Start)
Let S denote this sequence. Then:
a) take two adjacent integers x and y in S
b) let (x + y) = z
c) a(z) is even.
S is extended with the smallest integer not yet in S and not leading to a contradiction.
Additional remarks:
The sequence T where a(a(n)+a(n+1)) is always odd is simply A000027.
But if we force a(1)=2 we then get again a permutation of A000027:
U = 2, 1, 3, 5, 4, 6, 7, 9, 11, 13, 8, 10, 15, 12, ,14, 17, 16, 19, 18, 21, 23, 20, 22, 25, 27, 29, 31, 24, 26, 28, 33, ... (A256210).
The sequence V where a(a(n)+a(n+1)) is always prime is also a permutation of A000027:
V = 1, 2, 3, 4, 5, 6, 7, 8, 11, 9, 13, 10, 17, 12, 19, 14, 15, 23, 29, 31, 16, 37, 41, 18, ... (A255004).
(End)
At least for the first 73 elements, successive blocks of numbers of size 2^m for various m>=0 each form permutations of some set of consecutive positive integers. We see blocks [1], [2], [4, 3], ..., [8, 10, 7, 9], ..., [62, 61, 64, 66, 63, 65, 68, 67]. If b(0) is the first element in such a block and b(2^m-1) the last, then for 0 <= i <= 2^m-1, b(i) + b(2^m-i-1) is constant. For example, in the latter block, 62 + 67 = 61 + 68 = 64 + 65 = 66 + 63, etc. - David A. Corneth, Mar 22 2015
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
EXAMPLE
Checking the definition:
n = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ...
S = 1, 2, 4, 3, 5, 6, 8, 10, 7, 9, 12, 11, 13, 14, 15, 16, 18, 20, 17, 19, 22, 21,...
for n=1 then a(1)=1 and a(2)=2 and a(sum) reads a(1+2) reads a(3) which is 4 (even);
for n=2 then a(2)=2 and a(3)=4 and a(sum) reads a(2+4) reads a(6) which is 6 (even);
for n=3 then a(3)=4 and a(4)=3 and a(sum) reads a(4+3) reads a(7) which is 8 (even);
for n=4 then a(4)=3 and a(5)=5 and a(sum) reads a(3+5) reads a(8) which is 10 (even);
... etc.
MAPLE
N:= 100: # to get a(n) for n <= N
maxodd:= 1:
maxeven:= 0:
a[1]:= 1:
needeven:= {}:
for n from 2 to N do
if member(n, needeven) or maxeven < maxodd then
a[n]:= maxeven + 2;
maxeven:= a[n];
else
a[n]:= maxodd + 2;
maxodd:= a[n];
fi;
needeven:= needeven union {a[n-1]+a[n]};
od:
seq(a[n], n=1..N); # Robert Israel, Mar 26 2015
MATHEMATICA
M = 100;
maxodd = 1;
maxeven = 0;
a[1] = 1;
needeven = {};
For[n = 2, n <= M, n++, If[ MemberQ[needeven, n] || maxeven < maxodd, a[n] = maxeven + 2; maxeven = a[n], a[n] = maxodd + 2; maxodd = a[n]]; needeven = needeven ~Union~ {a[n-1] + a[n]}];
Array[a, M] (* Jean-François Alcover, Apr 30 2019, after Robert Israel *)
PROG
(PARI) {a=vector(100, i, 1); u=[1]/* used numbers beyond u[1] */; for(n=2, #a, if( a[n] < 0, a[n]=u[1]-u[1]%2; while(setsearch(u, a[n]+=2), ), a[n]=u[1]; while(setsearch(u, a[n]++), )); u=setunion(u, [a[n]]); while( #u>1 && u[2]==u[1]+1, u=u[2..#u]); a[n]+a[n-1]>#a || a[a[n]+a[n-1]]=-1)}
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and M. F. Hasler, Feb 11 2015
STATUS
approved