login
Permutation of nonnegative integers: a(0) = 0, a(n) = A268717(1+A268827(n-1)).
6

%I #14 Apr 28 2021 16:28:14

%S 0,1,3,2,6,7,5,4,13,12,11,10,15,14,31,30,27,26,9,8,25,24,55,54,51,50,

%T 17,16,49,48,29,28,21,20,19,18,23,22,103,102,99,98,33,32,97,96,45,44,

%U 37,36,35,34,39,38,53,52,61,60,59,58,63,62,47,46,43,42,57,56,41,40,199,198,195,194,65,64,193,192,77

%N Permutation of nonnegative integers: a(0) = 0, a(n) = A268717(1+A268827(n-1)).

%C The sixth "shifted power" of A268717.

%H Antti Karttunen, <a href="/A268831/b268831.txt">Table of n, a(n) for n = 0..8191</a>

%H Indranil Ghosh, <a href="/A268831/a268831.txt">C program to generate the sequence</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%F a(0) = 0, for n >= 1, a(n) = A268717(1+A268827(n-1)).

%t A003188[n_]:=BitXor[n, Floor[n/2]]; A006068[n_]:=If[n<2, n, Block[{m = A006068[Floor[n/2]]}, 2m + Mod[Mod[n, 2] + Mod[m, 2], 2]]]; A268717[n_]:=If[n<1, 0, A003188[ 1 + A006068[n - 1]]]; A268823[n_]:= If[n<2, n, A268717[1 + A268717[1 + A268717[n - 2]]]]; A268825[n_]:=If[n<1, 0, A268717[1 + A268823[n - 1]]]; A268827[n_]:=If[n<1, 0, A268717[1 + A268825[n - 1]]]; A268831[n_]:=If[n<1, 0, A268717[1 + A268827[n - 1]]];Table[A268831[n], {n, 0, 100}] (* _Indranil Ghosh_, Apr 03 2017 *)

%o (Scheme) (define (A268831 n) (if (zero? n) n (A268717 (+ 1 (A268827 (- n 1))))))

%o (PARI) A003188(n) = bitxor(n, n\2);

%o A006068(n) = if(n<2, n, {my(m = A006068(n\2)); 2*m + (n%2 + m%2)%2});

%o A268717(n) = if(n<1, 0, A003188(1 + A006068(n - 1)));

%o A268823(n) = if(n<2, n, A268717(1 + A268717(1 + A268717(n - 2))));

%o A268825(n) = if(n<1, 0, A268717(1+A268823(n - 1)));

%o A268827(n) = if(n<1, 0, A268717(1+A268825(n - 1)));

%o for(n=0, 100, print1(if(n<1, 0, A268717(1+A268827(n - 1))),", ")) \\ _Indranil Ghosh_, Apr 03 2017

%o (Python)

%o def A003188(n): return n^(n//2)

%o def A006068(n):

%o if n<2: return n

%o else:

%o m=A006068(n//2)

%o return 2*m + (n%2 + m%2)%2

%o def A268717(n): return 0 if n<1 else A003188(1 + A006068(n - 1))

%o def A268823(n): return A268717(1 + A268717(1 + A268717(n - 2))) if n>1 else n

%o def A268825(n): return A268717(1 + A268823(n - 1)) if n>0 else 0

%o def A268827(n): return A268717(1 + A268825(n - 1)) if n>0 else 0

%o def a(n): return A268717(1 + A268827(n - 1)) if n>0 else 0

%o print([a(n) for n in range(101)]) # _Indranil Ghosh_, Apr 03 2017

%Y Inverse: A268832.

%Y Row 6 of A268820.

%Y Cf. A003188, A006068, A268717, A268827.

%K nonn

%O 0,3

%A _Antti Karttunen_, Feb 14 2016