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 A003158 M1734 #35 Apr 21 2025 08:37:04 %S A003158 2,7,10,13,18,23,28,31,34,39,42,45,50,53,56,61,66,71,74,77,82,87,92, %T A003158 95,98,103,108,113,116,119,124,127,130,135,138,141,146,151,156,159 %N A003158 A self-generating sequence (see Comments in A003156 for the definition). %C A003158 Numbers not of the form Sum_{i>=2} e_i*A001045(i), with e(i) = 0 or 1. %C A003158 Indices of b in the sequence closed under a -> abc, b -> a, c -> a, starting with a(1) = a; see A092606 where a = 0, b = 2, c = 1. - _Philippe Deléham_, Apr 12 2004 %D A003158 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence). %H A003158 Alfred Brousseau, <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/fibonacci-tables.html">Fibonacci and Related Number Theoretic Tables</a>, Fibonacci Association, San Jose, CA, 1972. See p. 67. %H A003158 L. Carlitz, R. Scoville, and V. E. Hoggatt, Jr., <a href="https://web.archive.org/web/2024*/https://www.fq.math.ca/Scanned/10-5/carlitz3-a.pdf">Representations for a special sequence</a>, Fibonacci Quarterly 10.5 (1972), 499-518, 550. %F A003158 a(n) = A003157(n) - 1 = A079523(n) + n. - _Philippe Deléham_, Feb 22 2004 %o A003158 (Python) %o A003158 def A003158(n): %o A003158 def bisection(f,kmin=0,kmax=1): %o A003158 while f(kmax) > kmax: kmax <<= 1 %o A003158 kmin = kmax >> 1 %o A003158 while kmax-kmin > 1: %o A003158 kmid = kmax+kmin>>1 %o A003158 if f(kmid) <= kmid: %o A003158 kmax = kmid %o A003158 else: %o A003158 kmin = kmid %o A003158 return kmax %o A003158 def f(x): %o A003158 c, s = n+x, bin(x)[2:] %o A003158 l = len(s) %o A003158 for i in range(l&1,l,2): %o A003158 c -= int(s[i])+int('0'+s[:i],2) %o A003158 return c %o A003158 return bisection(f,n,n)+n-1 # _Chai Wah Wu_, Jan 29 2025 %Y A003158 Cf. A001045, A003156, A003157, A079523, A092606. %K A003158 nonn %O A003158 1,1 %A A003158 _N. J. A. Sloane_ %E A003158 Definition clarified by _N. J. A. Sloane_, Dec 26 2020