login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Replace 2^k in the binary expansion of n with A000930(k+2), Narayana's cows sequence.
2

%I #18 Feb 18 2022 21:02:10

%S 0,1,2,3,3,4,5,6,4,5,6,7,7,8,9,10,6,7,8,9,9,10,11,12,10,11,12,13,13,

%T 14,15,16,9,10,11,12,12,13,14,15,13,14,15,16,16,17,18,19,15,16,17,18,

%U 18,19,20,21,19,20,21,22,22,23,24,25,13,14,15,16,16,17

%N Replace 2^k in the binary expansion of n with A000930(k+2), Narayana's cows sequence.

%C A048715(n) = m, if and only if a(n) = m and for all k > n a(k) > m.

%p b:= (n, i, j, k)->`if`(n=0, 0, k*irem(n, 2, 'q')+b(q, j, k, i+k)):

%p a:= n-> b(n, 1$3):

%p seq(a(n), n=0..100); # _Alois P. Heinz_, Jan 26 2022

%o (Python)

%o def Interpretation(n):

%o f0, f1, f2, r = 1, 1, 1, 0

%o while n > 0:

%o if n%2 == 1:

%o r = r+f0

%o n, f0, f1, f2 = n//2, f0+f2, f0, f1

%o return r

%o n = 0

%o while n <= 69:

%o print(Interpretation(n), end = ", ")

%o n += 1

%o (PARI) my(p=Mod('x,'x^3-'x^2-1)); a(n) = vecsum(Vec(lift(subst(Pol(binary(n))*'x^2,'x,p)))); \\ _Kevin Ryde_, Dec 26 2021

%Y Cf. A000930, A048715, A350215, A350312.

%Y Cf. A022290 (analog for Fibonacci numbers).

%K nonn,base

%O 0,3

%A _A.H.M. Smeets_, Dec 24 2021