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 A385988 #16 Aug 07 2025 16:52:21 %S A385988 1,1,2,3,3,3,3,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,23,23,23,23,23,23,23, %T A385988 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, %U A385988 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23 %N A385988 a(1) = 1, and for any n > 1, a(n) is the largest k < n such that a(1) + ... + a(k) is a power of 2. %C A385988 In other words: a(1) = 1, and for any n > 0, if a(1) + ... + a(n) is a power of 2 then a(n+1) = n, otherwise a(n+1) = a(n). %C A385988 This sequence is unbounded: if a(1) + ... + a(n) = 2^i, let n = m * 2^j with m odd, note that n <= 2^i, so j <= i, let z be the multiplicative order of m modulo 2, let t = 2^(i-j) * (2^z - 1) / m, a(1) + ... + a(n) + t * n = 2^(z+i), so a(1) + ... + a(n) + u * n is a power of 2 for some u in the range n+1..t, and a(u+1) > a(n+1) = n. %H A385988 Paolo Xausa, <a href="/A385988/b385988.txt">Table of n, a(n) for n = 1..10000</a> %e A385988 Sequence begins: %e A385988 n a(n) a(1)+...+a(n) Power of 2? %e A385988 -- ---- ------------- ----------- %e A385988 1 1 1 Yes %e A385988 2 1 2 Yes %e A385988 3 2 4 Yes %e A385988 4 3 7 No %e A385988 5 3 10 No %e A385988 6 3 13 No %e A385988 7 3 16 Yes %e A385988 8 7 23 No %e A385988 9 7 30 No %e A385988 10 7 37 No %e A385988 11 7 44 No %e A385988 12 7 51 No %t A385988 Module[{s = -1, a = 1}, Table[If[DigitSum[s += a, 2] == 1, a = n - 1]; a, {n, 100}]] (* _Paolo Xausa_, Aug 07 2025 *) %o A385988 (PARI) { v = 1; t = 0; for (n = 1, 71, print1(v", "); if (hammingweight(t += v)==1, v = n;);); } %Y A385988 See A385986 for a similar sequence. %Y A385988 Cf. A386905 (distinct terms). %K A385988 nonn %O A385988 1,3 %A A385988 _Rémy Sigrist_, Jul 14 2025