login
A268825
Permutation of nonnegative integers: a(0) = 0, a(n) = A268717(1+A268823(n-1)).
7
0, 1, 3, 2, 6, 7, 4, 5, 14, 15, 12, 13, 26, 27, 24, 25, 10, 11, 8, 9, 50, 51, 48, 49, 18, 19, 16, 17, 30, 31, 28, 29, 22, 23, 20, 21, 98, 99, 96, 97, 34, 35, 32, 33, 46, 47, 44, 45, 38, 39, 36, 37, 54, 55, 52, 53, 62, 63, 60, 61, 42, 43, 40, 41, 58, 59, 56, 57, 194, 195, 192, 193, 66, 67, 64, 65, 78, 79, 76, 77, 70, 71, 68, 69, 86, 87
OFFSET
0,3
COMMENTS
The "fourth shifted power" of permutation A268717.
FORMULA
a(0) = 0, and for n >= 1, a(n) = A268717(1+A268823(n-1)).
MATHEMATICA
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]]]; Table[A268825[n], {n, 0, 100}] (* Indranil Ghosh, Apr 03 2017 *)
PROG
(Scheme) (define (A268825 n) (if (zero? n) n (A268717 (+ 1 (A268823 (- n 1))))))
(PARI) A003188(n) = bitxor(n, n\2);
A006068(n) = if(n<2, n, {my(m = A006068(n\2)); 2*m + (n%2 + 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))));
for(n=0, 100, print1(if(n<1, 0, A268717(1+A268823(n - 1))), ", ")) \\ Indranil Ghosh, Apr 03 2017
(Python)
def A003188(n): return n^(n//2)
def A006068(n):
if n<2: return n
else:
m=A006068(n//2)
return 2*m + (n%2 + m%2)%2
def A268717(n): return 0 if n<1 else A003188(1 + A006068(n - 1))
def A268823(n): return A268717(1 + A268717(1 + A268717(n - 2))) if n>1 else n
def a(n): return A268717(1 + A268823(n - 1)) if n>0 else 0
print([a(n) for n in range(101)]) # Indranil Ghosh, Apr 03 2017
CROSSREFS
Inverse: A268826.
Row 4 of array A268820.
Sequence in context: A154445 A165199 A371962 * A245812 A268826 A182849
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 14 2016
STATUS
approved