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.

A323908 Reversing binary representation of A004718, Per Nørgård's "infinity sequence".

This page as a plain text file.
%I A323908 #13 Mar 02 2023 19:10:38
%S A323908 0,1,3,2,1,0,6,7,3,2,0,1,2,3,5,4,1,0,6,7,0,1,3,2,6,7,1,0,7,6,12,13,3,
%T A323908 2,0,1,2,3,5,4,0,1,3,2,1,0,6,7,2,3,5,4,3,2,0,1,5,4,2,3,4,5,15,14,1,0,
%U A323908 6,7,0,1,3,2,6,7,1,0,7,6,12,13,0,1,3,2,1,0,6,7,3,2,0,1,2,3,5,4,6,7,1,0,7,6,12,13,1,0
%N A323908 Reversing binary representation of A004718, Per Nørgård's "infinity sequence".
%C A323908 The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.
%H A323908 Antti Karttunen, <a href="/A323908/b323908.txt">Table of n, a(n) for n = 0..65536</a>
%H A323908 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A323908 If A004718(n) <= 0, a(n) = A048724(-A004718(n)), otherwise a(n) = A065621(A004718(n)).
%F A323908 For all n >= 1, A065620(a(n)) = A004718(n).
%o A323908 (PARI)
%o A323908 up_to = 65536;
%o A323908 A004718list(up_to) = { my(v=vector(up_to)); v[1]=1; v[2]=-1; for(n=3, up_to, v[n] = if(n%2, 1+v[n>>1], -v[n/2])); (v); }; \\ After code in A004718.
%o A323908 v004718 = A004718list(up_to);
%o A323908 A004718(n) = if(!n,n,v004718[n]);
%o A323908 A048724(n) = bitxor(n, n<<1);
%o A323908 A065621(n) = bitxor(n-1,n+n-1);
%o A323908 A323908(n) = if(A004718(n)<=0, A048724(-A004718(n)), A065621(A004718(n)));
%o A323908 (Python)
%o A323908 from itertools import groupby
%o A323908 def A323908(n):
%o A323908     c = 0
%o A323908     for k, g in groupby(bin(n)[2:]):
%o A323908         c = c+len(list(g)) if k == '1' else (-c if len(list(g))&1 else c)
%o A323908     return -c^(-c<<1) if c<=0 else c^(c&~-c)<<1 # _Chai Wah Wu_, Mar 02 2023
%Y A323908 Cf. A004718, A048724, A065620, A065621, A083866 (positions of zeros), A323907 (rgs-transform), A323909.
%K A323908 nonn
%O A323908 0,3
%A A323908 _Antti Karttunen_, Feb 09 2019