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.

Showing 1-4 of 4 results.

A078627 Write n in binary; repeatedly sum the "digits" until reaching 1; a(n) = 1 + number of steps required.

Original entry on oeis.org

1, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 3, 3, 4, 4, 3, 4, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 3, 4, 4, 3, 4, 3, 3, 4, 3, 4, 4, 3, 4, 3, 3, 4, 4, 3, 3, 4, 3, 4, 4, 4, 2, 3, 3, 4, 3, 4, 4, 3, 3, 4, 4, 3, 4, 3, 3, 4, 3, 4, 4, 3, 4, 3, 3, 4, 4, 3, 3, 4, 3, 4, 4, 4, 3, 4, 4, 3, 4, 3, 3, 4, 4, 3
Offset: 1

Views

Author

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

Keywords

Comments

The terms a(n) are unbounded. The smallest n with a(n) = m, n_min(m), however may be exorbitantly large, even for small m. It can be calculated by the following recurrence: n_min(1) = 1; n_min(2) = 2; n_min(m) = 2^n_min(m-1) - 1 {if m > 2};

Examples

			a(13) = 4 because 13 = (1101) -> (1+1+0+1 = 11) -> (1+1 = 10) -> (1+0 = 1) = 1. (Three iterations were required to reach 1.)
		

Crossrefs

Cf. A000120.
One more than A180094. Row lengths of A381962.

Programs

  • Maple
    for n from 1 to 500 do h := n:a[n] := 1:while(h>1) do a[n] := a[n]+1: b := convert(h,base,2):h := sum(b[j],j=1..nops(b)):od:od:seq(a[j],j=1..500);
  • Mathematica
    Table[Length[NestWhileList[Total[IntegerDigits[#,2]]&,n,#>1&]],{n,110}] (* Harvey P. Dale, Oct 10 2011 *)
  • PARI
    A078627(n) = { my(k=1); while(n>1, n = hammingweight(n); k += 1); (k); }; \\ Antti Karttunen, Jul 09 2017
    
  • Python
    def a(n):
        c = 1 if n > 1 else 0
        while (n:=n.bit_count()) > 1:
            c += 1
        return c + 1
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Mar 12 2025

Formula

a(1) = 1; for n > 1, a(n) = 1 + a(A000120(n)), where A000120 gives the number of occurrences of digit 1 in binary representation of n.
a(n) = 1 + A180094(n). - Antti Karttunen, Jul 09 2017

Extensions

Description corrected by Antti Karttunen, Jul 09 2017

A381963 Irregular triangle read by rows, where row n lists the iterates of f(x), starting at x = n until f(x) < 10, where f(x) is the digital sum of x (A007953).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19, 10, 1, 20, 2, 21, 3, 22, 4, 23, 5, 24, 6, 25, 7, 26, 8, 27, 9, 28, 10, 1, 29, 11, 2, 30, 3, 31, 4, 32, 5, 33, 6, 34, 7, 35, 8, 36, 9, 37, 10, 1, 38, 11, 2, 39, 12, 3
Offset: 0

Views

Author

Paolo Xausa, Mar 11 2025

Keywords

Examples

			Triangle begins:
  n\k|  0   1   2
  ---------------
   0 |  0;
   1 |  1;
   2 |  2;
   3 |  3;
   4 |  4;
   5 |  5;
   6 |  6;
   7 |  7;
   8 |  8;
   9 |  9;
  10 | 10,  1;
  11 | 11,  2;
  12 | 12,  3;
  13 | 13,  4;
  14 | 14,  5;
  15 | 15,  6;
  16 | 16,  7;
  17 | 17,  8;
  18 | 18,  9;
  19 | 19, 10,  1;
  20 | 20,  2;
  ...
		

Crossrefs

Cf. A007953, A010888 (right border), A031286 (row lengths - 1), A381964 (row sums).

Programs

  • Mathematica
    A381963row[n_] := NestWhileList[DigitSum, n, # >= 10 &];
    Array[A381963row, 40, 0]

Formula

T(n,0) = n and, for k = 1..A031286(n), T(n,k) = A007953(T(n,k-1)).

A381965 Irregular triangle read by rows, where row n lists the iterates of f(x), starting at x = n until f(x) < 10, where f(x) is the multiplicative digital root of x (A031347).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 11, 1, 12, 2, 13, 3, 14, 4, 15, 5, 16, 6, 17, 7, 18, 8, 19, 9, 20, 0, 21, 2, 22, 4, 23, 6, 24, 8, 25, 10, 0, 26, 12, 2, 27, 14, 4, 28, 16, 6, 29, 18, 8, 30, 0, 31, 3, 32, 6, 33, 9, 34, 12, 2, 35, 15, 5, 36, 18, 8, 37, 21, 2
Offset: 0

Views

Author

Paolo Xausa, Mar 11 2025

Keywords

Examples

			Triangle begins:
  n\k|  0   1   2
  ---------------
   0 |  0;
   1 |  1;
   2 |  2;
   3 |  3;
   4 |  4;
   5 |  5;
   6 |  6;
   7 |  7;
   8 |  8;
   9 |  9;
  10 | 10,  0;
  11 | 11,  1;
  12 | 12,  2;
  13 | 13,  3;
  14 | 14,  4;
  15 | 15,  5;
  16 | 16,  6;
  17 | 17,  7;
  18 | 18,  8;
  19 | 19,  9;
  20 | 20,  0;
  21 | 21,  2;
  22 | 22,  4;
  23 | 23,  6;
  24 | 24,  8;
  25 | 25, 10,  0;
  ...
		

Crossrefs

Cf. A031346 (row lengths - 1), A031347 (right border), A381966 (row sums).

Programs

  • Mathematica
    A381965row[n_] := NestWhileList[Times @@ IntegerDigits[#] &, n, # >= 10 &];
    Array[A381965row, 50, 0]

Formula

T(n,0) = n and, for k = 1..A031346(n), T(n,k) = A031347(T(n,k-1)).

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
Showing 1-4 of 4 results.