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.
%I A366793 #12 Oct 24 2023 11:47:40 %S A366793 0,1,0,2,1,0,1,2,0,2,0,1,2,0,0,3,1,0,1,2,0,1,0,2,1,2,1,0,2,1,0,4,0,2, %T A366793 0,1,2,0,0,3,0,1,0,2,1,0,1,2,2,0,0,3,0,2,0,1,0,3,2,0,3,0,3,4,1,0,1,2, %U A366793 0,1,0,2,1,2,1,0,2,1,0,4,0,1,0,2,1,0,1,2,0,2,0,1,2,0,0,3,1,2,1,0,2,1,0,4,1,0 %N A366793 Binary encoding of the ones in the balanced ternary representation of Per Nørgård's "infinity sequence". %C A366793 The composer Per Nørgård's name is also written in the OEIS as Per Noergaard. %H A366793 Antti Karttunen, <a href="/A366793/b366793.txt">Table of n, a(n) for n = 0..65536</a> %H A366793 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a> %F A366793 a(n) = A289813(A323909(n)). %e A366793 A004718(254) = -7. In balanced ternary representation (see A117966) this is represented as -1*9 + 1*3 + -1*1. Taking the positive coefficients, and converting them to a binary string gives "10", which in base-2 (A007088) is equal to 2, therefore a(254) = 2. %o A366793 (PARI) %o A366793 up_to = 65536; %o A366793 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); }; \\ From the code in A004718. %o A366793 v004718 = A004718list(up_to); %o A366793 A004718(n) = if(!n,n,v004718[n]); %o A366793 A117967(n) = if(n<=1,n,if(!(n%3),3*A117967(n/3),if(1==(n%3),1+3*A117967((n-1)/3),2+3*A117967((n+1)/3)))); %o A366793 A117968(n) = if(1==n,2,if(!(n%3),3*A117968(n/3),if(1==(n%3),2+3*A117968((n-1)/3),1+3*A117968((n+1)/3)))); %o A366793 A323909(n) = { my(x = A004718(n)); if(x >= 0,A117967(x),A117968(-x)); }; %o A366793 A289813(n) = { my(d=digits(n, 3)); fromdigits(vector(#d, i, if (d[i]==1, 1, 0)), 2); }; %o A366793 A366793(n) = A289813(A323909(n)); %Y A366793 Cf. A004718, A007088, A117966, A289813, A323909, A366794. %K A366793 nonn %O A366793 0,4 %A A366793 _Antti Karttunen_, Oct 24 2023