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.

A037095 "Sloping binary representation" of powers of 3 (A000244), slope = -1.

Original entry on oeis.org

1, 1, 3, 1, 3, 9, 11, 17, 19, 25, 123, 65, 195, 169, 171, 753, 435, 249, 2267, 4065, 8163, 841, 843, 31313, 29651, 39769, 38331, 30081, 160643, 49769, 53867, 563377, 700659, 1611961, 760731, 1207073, 5668771, 5566345, 11844619, 8699025, 10386067, 55868313
Offset: 0

Views

Author

Antti Karttunen, Jan 28 1999

Keywords

Examples

			When powers of 3 are written in binary (see A004656), under each other as:
  000000000001 (1)
  000000000011 (3)
  000000001001 (9)
  000000011011 (27)
  000001010001 (81)
  000011110011 (243)
  001011011001 (729)
  100010001011 (2187)
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).
		

Crossrefs

Programs

  • Maple
    A037095:= n-> add(bit_n(3^(n-i), i)*(2^i), i=0..n):
    bit_n := (x, n) -> `mod`(floor(x/(2^n)), 2):
    seq(A037095(n), n=0..41);
    # second Maple program:
    b:= proc(n) option remember; `if`(n=0, 1, (p->
           expand((p-(p mod 2))*x/2)+3^n)(b(n-1)))
        end:
    a:= n-> subs(x=2, b(n) mod 2):
    seq(a(n), n=0..42);  # Alois P. Heinz, Dec 10 2020
  • PARI
    A339601(n) = { my(m=1, s=0); while(n>=m, s += bitand(m,n); m <<= 1; n \= 3); (s); };
    A037095(n) = A339601(3^n); \\ Antti Karttunen, Dec 09 2020
    
  • PARI
    BINSLOPE(f) = n -> sum(i=0,n,bitand(2^(n-i),f(i))); \\ General transformation for these kinds of sequences.
    A037095 = BINSLOPE(n -> 3^n); \\ And its application to A000244. - Antti Karttunen, Dec 09 2020

Formula

a(n) = A339601(A000244(n)). - Antti Karttunen, Dec 09 2020

Extensions

Entry revised Dec 29 2007
More terms from Sean A. Irvine, Dec 08 2020