login
A356964
Replace 2^k in binary expansion of n with tribonacci(k+3) (where tribonacci corresponds to A000073).
3
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,3
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.
FORMULA
a(A003726(n+1)) = n.
a(A003796(n+1)) = n.
EXAMPLE
For n = 9:
- 9 = 2^3 + 2^0,
- so a(9) = A000073(3+3) + A000073(0+3) = 7 + 1 = 8.
PROG
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Sep 06 2022
STATUS
approved