# [seqfan] Re: Two neighbors sum -- and odd ranks in S

M. F. Hasler oeis at hasler.fr
Wed Oct 22 05:03:13 CEST 2014

```Eric,

congratulations on this interesting if not fundamental non-base
sequence which definitely was missing in the OEIS.

I would however suggest a little re-indexing; since you consider
really have a permutation in the sense of bijective map from {0,1,...}
into itself, and the relation becomes even simpler & more natural,
a(2n)=a(n)+a(n+1), n=0,....

My little program* confirms your data (at first sight :)).
I submit the proposal as https://oeis.org/draft/A249129

Best wishes,
Maximilian

{a=vector(200);a[1]=1;a[3]=2;u=7;for(n=4,#a, a[n]=if( n%2,
a[n\2+2]+a[n\2+1], k=2; while(bittest(u,k++),); u+=1<<k; k);
u=bitor(u,1<<(a[n-1]+a[n])); n<#a && a[n+1] && u=bitor(u,1<<(a[n+1]+a[n])));a}

1, 0, 2, 3, 5, 4, 8, 6, 9, 7, 12, 10, 14, 11, 15, 13, 16, 17, 19, 18,
22, 20, 24, 21, 25, 23, 26, 27, 28, 30, 29, 31, 33, 32, 36, 34, 37,
35, 40, 38, 42, 39, 44, 41, 45, 43, 46, 47, 48, 50, 49, 51, 53, 52,
55, 54, 58, 56, 59, 57, 60, 61, 64, 62, 65, 63, 68,...

Check with rule : a(n)+a(n+1)=a(2n), n=0,....
a(0)=0 + a(1)=1 = 1 =?= a(2*0) no.
a(0)=1 + a(1)=0 = 1 =?= a(2*0) yes.
a(1)=0 + a(2)=2 = 2 =?= a(2*1) yes.
a(2)=2 + a(3)=3 = 5 = a(4) ok
a(3)=4 + a(4)=5 = 9 = a(6) ok
...

On Tue, Oct 21, 2014 at 3:58 PM, Eric Angelini <Eric.Angelini at kntv.be> wrote:
>
>
> Hello SeqFans,
> S is the lexically first permutation
> of the Natural numbers such that
> a(n)+a(n+1)=a(2n-1)
> S = 1,0,2,3,5,4,8,6,9,7,12,10,14,11,15,13,16,17,19,18,22,20,24,21,25,23,26,27,28,30,29,31,33,32,36,34,37,35,40,38,42,39,44,41,45,43,46,47,48,50,49,51,53,52,55,54,...
>
>

```