cp's OEIS Frontend

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.

A078677 Write n in binary; repeatedly sum the "digits" until reaching 1; a(n) = sum of these sums (including '1' and n itself).

Original entry on oeis.org

1, 3, 6, 5, 8, 9, 13, 9, 12, 13, 17, 15, 19, 20, 20, 17, 20, 21, 25, 23, 27, 28, 28, 27, 31, 32, 32, 34, 34, 35, 39, 33, 36, 37, 41, 39, 43, 44, 44, 43, 47, 48, 48, 50, 50, 51, 55, 51, 55, 56, 56, 58, 58, 59, 63, 62, 62, 63, 67, 65, 69, 70, 72, 65, 68, 69, 73, 71, 75, 76, 76, 75
Offset: 1

Views

Author

Frank Schwellinger (nummer_eins(AT)web.de), Dec 17 2002

Keywords

Examples

			a(13) = 19 because 13 = (1101) -> (1+1+0+1 = 11) -> (1+1 = 10) -> (1+0 = 1) = 1 and 1101+11+10+1 (binary) = 19 (decimal).
		

Crossrefs

Row sums of A381962.

Programs

  • Mathematica
    A078677[n_] := Total[NestWhileList[DigitSum[#, 2] &, n, # > 1 &]];
    Array[A078677, 100] (* Paolo Xausa, Mar 11 2025 *)
  • Python
    def a(n):
        s = n if n > 1 else 0
        while (n:=n.bit_count()) > 1:
            s += n
        return s + 1
    print([a(n) for n in range(1, 73)]) # Michael S. Branicky, Mar 12 2025

Formula

a(1) = 1; for n > 1, a(n) = n + a(A000120(n)).
a(n) = Sum_{k = 0..A180094(n)} A381962(n,k). - Paolo Xausa, Mar 12 2025