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.
%I A385991 #17 Aug 01 2025 11:05:54 %S A385991 1,2,2,3,3,4,4,4,4,5,5,6,6,6,6,6,6,6,6,7,7,8,8,8,8,8,8,8,8,8,8,8,8,9, %T A385991 9,10,10,11,11,12,12,12,12,13,13,14,14,14,14,14,14,14,14,14,14,14,14, %U A385991 14,14,14,14,14,14,14,14,14,14,14,14,15,15,15,15,16 %N A385991 a(n) is the number of distinct values among A002487(0), ..., A002487(n). %C A385991 This sequence exhibits large runs of consecutive equal values. %H A385991 Rémy Sigrist, <a href="/A385991/b385991.txt">Table of n, a(n) for n = 0..10000</a> %H A385991 Rémy Sigrist, <a href="/A385991/a385991.gp.txt">PARI program</a> %H A385991 <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a> %F A385991 a(A091945(n)) = n (this is the first occurrence of n in the sequence). %F A385991 a(2*n) = a(2*n-1) for any n > 0. %e A385991 Sequence begins: %e A385991 n a(n) A002487(n) %e A385991 -- ---- ---------- %e A385991 0 1 0 %e A385991 1 2 1 %e A385991 2 2 1 %e A385991 3 3 2 %e A385991 4 3 1 %e A385991 5 4 3 %e A385991 6 4 2 %e A385991 7 4 3 %e A385991 8 4 1 %e A385991 9 5 4 %e A385991 10 5 3 %e A385991 11 6 5 %e A385991 12 6 2 %e A385991 13 6 5 %e A385991 14 6 3 %e A385991 15 6 4 %e A385991 16 6 1 %e A385991 17 6 5 %e A385991 18 6 4 %e A385991 19 7 7 %o A385991 (PARI) \\ See Links section. %o A385991 (Python) %o A385991 def A385991(n): %o A385991 if n==0: return 1 %o A385991 a, b, s, c = 0, 1, {0,1}, 2 %o A385991 for i in range(n-1): %o A385991 a, b = b, ((a//b<<1)+1)*b-a %o A385991 if b not in s: %o A385991 c += 1 %o A385991 s.add(b) %o A385991 return c # _Chai Wah Wu_, Jul 17 2025 %Y A385991 See A061069, A061070 and A061071 for similar sequences. %Y A385991 Cf. A002487, A091945, A385993. %K A385991 nonn %O A385991 0,2 %A A385991 _Rémy Sigrist_, Jul 14 2025