cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A268831 #14 Apr 28 2021 16:28:14
%S A268831 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 A268831 17,16,49,48,29,28,21,20,19,18,23,22,103,102,99,98,33,32,97,96,45,44,
%U A268831 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 A268831 Permutation of nonnegative integers: a(0) = 0, a(n) = A268717(1+A268827(n-1)).
%C A268831 The sixth "shifted power" of A268717.
%H A268831 Antti Karttunen, <a href="/A268831/b268831.txt">Table of n, a(n) for n = 0..8191</a>
%H A268831 Indranil Ghosh, <a href="/A268831/a268831.txt">C program to generate the sequence</a>
%H A268831 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A268831 a(0) = 0, for n >= 1, a(n) = A268717(1+A268827(n-1)).
%t A268831 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 A268831 (Scheme) (define (A268831 n) (if (zero? n) n (A268717 (+ 1 (A268827 (- n 1))))))
%o A268831 (PARI) A003188(n) = bitxor(n, n\2);
%o A268831 A006068(n) = if(n<2, n, {my(m = A006068(n\2)); 2*m + (n%2 + m%2)%2});
%o A268831 A268717(n) = if(n<1, 0, A003188(1 + A006068(n - 1)));
%o A268831 A268823(n) = if(n<2, n, A268717(1 + A268717(1 + A268717(n - 2))));
%o A268831 A268825(n) = if(n<1, 0,  A268717(1+A268823(n - 1)));
%o A268831 A268827(n) = if(n<1, 0,  A268717(1+A268825(n - 1)));
%o A268831 for(n=0, 100, print1(if(n<1, 0,  A268717(1+A268827(n - 1))),", ")) \\ _Indranil Ghosh_, Apr 03 2017
%o A268831 (Python)
%o A268831 def A003188(n): return n^(n//2)
%o A268831 def A006068(n):
%o A268831     if n<2: return n
%o A268831     else:
%o A268831         m=A006068(n//2)
%o A268831         return 2*m + (n%2 + m%2)%2
%o A268831 def A268717(n): return 0 if n<1 else A003188(1 + A006068(n - 1))
%o A268831 def A268823(n): return A268717(1 + A268717(1 + A268717(n - 2))) if n>1 else n
%o A268831 def A268825(n): return A268717(1 + A268823(n - 1)) if n>0 else 0
%o A268831 def A268827(n): return A268717(1 + A268825(n - 1)) if n>0 else 0
%o A268831 def a(n): return A268717(1 + A268827(n - 1)) if n>0 else 0
%o A268831 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Apr 03 2017
%Y A268831 Inverse: A268832.
%Y A268831 Row 6 of A268820.
%Y A268831 Cf. A003188, A006068, A268717, A268827.
%K A268831 nonn
%O A268831 0,3
%A A268831 _Antti Karttunen_, Feb 14 2016