# [seqfan] Re: Small perturbations in the natural flow

Maximilian Hasler maximilian.hasler at gmail.com
Thu Apr 12 22:29:40 CEST 2012

```Eric,

the following very simple PARI script calculates your sequence but
gives other values for 71..75 and 86..88.
Regards,
Maximilian

{R=vector(300);u=0; for(n=1,100, a=0; while( bittest(u,a++)
|| (R[n] &(a+R[n])%2) || (R[n+a+1] & (a+R[n+a+1])%2),);
u+=1<<R[n]=a; R[n+a+1]=bittest(a,0)-2); vecextract(R,"1..100")}

R = [1, 2, 3, 4, 6, 7, 5, 8, 10, 11, 9, 12, 13, 15, 16, 14, 18, 19,
17, 20, 21, 23, 24, 22, 26, 27, 25, 28, 29, 31, 32, 30, 33, 34, 35,
36, 37, 39, 40, 38, 42, 43, 41, 44, 45, 47, 48, 46, 49, 50, 51, 52,
53, 55, 56, 54, 58, 59, 57, 60, 61, 63, 64, 62, 65, 66, 67, 68, 70,
71, 69, 72, 74, 75, 73, 76, 77, 79, 80, 78, 81, 82, 83, 84, 85, 87,
88, 86, 90, 91, 89, 92, 93, 95, 96, 94, 97, 98, 99, 100]

Maximilian

On Thu, Apr 12, 2012 at 12:51 PM, Eric Angelini <Eric.Angelini at kntv.be> wrote:
> Hello SeqFans,
>
> Pick any term 't' of R and jump to the right over 't' terms:
> -- if 't' is odd you'll land on an odd integer;
> -- if 't' is even you'll land on an even integer.
>
> R =
1,2,3,4,6,7,5,8,10,11,9,12,13,15,16,14,18,19,17,20,21,23,
24,22,26,27,25,28,29,31,32,30,33,34,35,36,37,39,40,38,42,43,
41,44,45,47,48,46,49,50,51,52,53,55,56,54,58,59,57,60,61,63,
64,62,65,66,67,68,70,71,73,69,72,74,75,76,77,79,80,78,81,82,
83,84,85,86,87,88,90,91,89,92,93,95,96,94,97,98,99,100,...
>
> R is the lexicographically first such sequence if we want R
> to be a permutation of the Naturals.
> Formulas:
> -- if a(n) is odd then a(n+a(n)+1) is odd
> -- if a(n) is even then a(n+a(n)+1) is even
> -- always extend R with the smallest available integer not

```