%I #31 Dec 10 2020 20:30:11
%S 1,1,3,1,3,9,11,17,19,25,123,65,195,169,171,753,435,249,2267,4065,
%T 8163,841,843,31313,29651,39769,38331,30081,160643,49769,53867,563377,
%U 700659,1611961,760731,1207073,5668771,5566345,11844619,8699025,10386067,55868313
%N "Sloping binary representation" of powers of 3 (A000244), slope = -1.
%H Alois P. Heinz, <a href="/A037095/b037095.txt">Table of n, a(n) for n = 0..2000</a>
%F a(n) = A339601(A000244(n)). - _Antti Karttunen_, Dec 09 2020
%e When powers of 3 are written in binary (see A004656), under each other as:
%e 000000000001 (1)
%e 000000000011 (3)
%e 000000001001 (9)
%e 000000011011 (27)
%e 000001010001 (81)
%e 000011110011 (243)
%e 001011011001 (729)
%e 100010001011 (2187)
%e and one collects their bits from the column-0 to NW-direction (from the least to the most significant end), one gets 1 (1), 01 (1), 011 (3), 0001 (1), 00011 (3), 001001 (9), etc. (See A105033 for similar transformation done on nonnegative integers, A001477).
%p A037095:= n-> add(bit_n(3^(n-i), i)*(2^i), i=0..n):
%p bit_n := (x, n) -> `mod`(floor(x/(2^n)), 2):
%p seq(A037095(n), n=0..41);
%p # second Maple program:
%p b:= proc(n) option remember; `if`(n=0, 1, (p->
%p expand((p-(p mod 2))*x/2)+3^n)(b(n-1)))
%p end:
%p a:= n-> subs(x=2, b(n) mod 2):
%p seq(a(n), n=0..42); # _Alois P. Heinz_, Dec 10 2020
%o (PARI)
%o A339601(n) = { my(m=1, s=0); while(n>=m, s += bitand(m,n); m <<= 1; n \= 3); (s); };
%o A037095(n) = A339601(3^n); \\ _Antti Karttunen_, Dec 09 2020
%o (PARI)
%o BINSLOPE(f) = n -> sum(i=0,n,bitand(2^(n-i),f(i))); \\ General transformation for these kinds of sequences.
%o A037095 = BINSLOPE(n -> 3^n); \\ And its application to A000244. - _Antti Karttunen_, Dec 09 2020
%Y Cf. A105033, A000244, A037093, A037094, A037096, A037097, A339601.
%K nonn,base
%O 0,3
%A _Antti Karttunen_, Jan 28 1999. Entry revised Dec 29 2007.
%E More terms from _Sean A. Irvine_, Dec 08 2020