%I #18 Dec 16 2022 17:59:02
%S 0,1,2,4,5,16,9,10,17,19,18,22,21,34,36,46,38,37,41,94,42,70,69,76,75,
%T 73,77,133,74,82,86,139,137,85,141,157,138,268,162,148,146,289,150,
%U 154,182,166,149,283,165,169,276,274,281,637,170,292,282,307,314
%N a(n) is the least k such that fusc(k) + fusc(k+1) = n, where "fusc" is Stern's diatomic series (A002487).
%C This sequence is well defined:
%C - a(1) = 0,
%C - for any n > 1, 1/(n-1) is in reduced form, so fusc(k) = 1 and fusc(k+1) = n-1 for some k, and a(n) <= k.
%H Rémy Sigrist, <a href="/A359050/b359050.txt">Table of n, a(n) for n = 1..8192</a>
%H Rémy Sigrist, <a href="/A359050/a359050.gp.txt">PARI program</a>
%H <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%F A002487(a(n)) + A002487(a(n)+1) = n.
%e The first terms are:
%e n a(n) fusc(a(n)) fusc(a(n)+1)
%e --- ----- ---------- ------------
%e 1 0 0 1
%e 2 1 1 1
%e 3 2 1 2
%e 4 4 1 3
%e 5 5 3 2
%e 6 16 1 5
%e 7 9 4 3
%e 8 10 3 5
%e 9 17 5 4
%e 10 19 7 3
%o (PARI) See Links section.
%o (Python)
%o def A359050(n):
%o f, g, k = 0, 1, 0
%o while f+g-n:
%o k += 1
%o m, a = k+1, [1,0]
%o while m:
%o a[m&1] = sum(a)
%o m >>=1
%o f, g = g, a[1]
%o return k # _Chai Wah Wu_, Dec 16 2022
%Y Cf. A002487.
%K nonn,look
%O 1,3
%A _Rémy Sigrist_, Dec 14 2022