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.

A356964 Replace 2^k in binary expansion of n with tribonacci(k+3) (where tribonacci corresponds to A000073).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 13, 14, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 38, 37, 38, 39, 40, 41, 42, 43, 44, 44, 45, 46, 47, 48, 49, 50, 51, 44, 45, 46, 47
Offset: 0

Views

Author

Rémy Sigrist, Sep 06 2022

Keywords

Comments

This sequence is to tribonacci numbers (A000073) what A022290 is to Fibonacci numbers (A000045).
For any k >= 0, k appears A117546(k) times in this sequence.

Examples

			For n = 9:
- 9 = 2^3 + 2^0,
- so a(9) = A000073(3+3) + A000073(0+3) = 7 + 1 = 8.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (v=0, k); while (n, n-=2^k=valuation(n,2); v+=([0,1,0; 0,0,1; 1,1,1]^(3+k))[2,1]); return (v); }
    
  • Python
    def A356964(n):
        a, b, c, s = 1,2,4,0
        for i in bin(n)[-1:1:-1]:
            s += int(i)*a
            a, b, c = b, c, a+b+c
        return s # Chai Wah Wu, Sep 10 2022

Formula

a(A003726(n+1)) = n.
a(A003796(n+1)) = n.