login
Balanced ternary representation of A004718, Per Nørgård's "infinity sequence".
6

%I #6 Feb 10 2019 23:07:24

%S 0,1,2,5,1,0,7,3,2,5,0,1,5,2,6,4,1,0,7,3,0,1,2,5,7,3,1,0,3,7,8,17,2,5,

%T 0,1,5,2,6,4,0,1,2,5,1,0,7,3,5,2,6,4,2,5,0,1,6,4,5,2,4,6,22,15,1,0,7,

%U 3,0,1,2,5,7,3,1,0,3,7,8,17,0,1,2,5,1,0,7,3,2,5,0,1,5,2,6,4,7,3,1,0,3,7,8,17,1,0

%N Balanced ternary representation of A004718, Per Nørgård's "infinity sequence".

%C The composer Per Nørgård's name is also written in the OEIS as Per Noergaard.

%H Antti Karttunen, <a href="/A323909/b323909.txt">Table of n, a(n) for n = 0..65536</a>

%F If A004718(n) >= 0, then a(n) = A117967(A004718(n)), otherwise a(n) = A117968(-A004718(n)).

%F For all n >= 1, A117966(a(n)) = A004718(n).

%o (PARI)

%o up_to = 65536;

%o 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 v004718 = A004718list(up_to);

%o A004718(n) = if(!n,n,v004718[n]);

%o 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 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 A323909(n) = { my(x = A004718(n)); if(x >= 0,A117967(x),A117968(-x)); };

%Y Cf. A004718, A083866 (positions of zeros), A117966, A117967, A117968, A323907 (rgs-transform), A323908.

%K nonn

%O 0,3

%A _Antti Karttunen_, Feb 10 2019