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.

Previous Showing 11-12 of 12 results.

A050603 A001511 with every term repeated.

Original entry on oeis.org

1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 4, 4, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 5, 5, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 4, 4, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 6, 6, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 4, 4, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 5, 5, 1, 1, 2, 2, 1, 1, 3, 3, 1, 1, 2, 2, 1, 1, 4
Offset: 0

Views

Author

Antti Karttunen Jun 22 1999

Keywords

Comments

Column 2 of A050600: a(n) = add1c(n,2).
Absolute values of A094267.
Consider the Collatz (or 3x+1) problem and the iterative sequence c(k) where c(0)=n is a positive integer and c(k+1)=c(k)/2 if c(k) is even, c(k+1)=(3*c(k)+1)/2 if c(k) is odd. Then a(n) is the minimum number of iterations in order to have c(a(n)) odd if n is even or c(a(n)) even if n is odd. - Benoit Cloitre, Nov 16 2001

Crossrefs

Bisection gives column 1 of A050600: A001511.

Programs

  • Mathematica
    With[{c=Table[Position[Reverse[IntegerDigits[n,2]],1,1,1],{n,110}]// Flatten}, Riffle[c,c]] (* Harvey P. Dale, Dec 06 2018 *)
    a[n_] := IntegerExponent[Floor[n/2]+1, 2] + 1; Array[a, 100, 0] (* Amiram Eldar, May 22 2025 *)
  • PARI
    a(n)=valuation(n+2-n%2,2) \\ Charles R Greathouse IV, Oct 14 2013
    
  • PARI
    {a(n) = my(A); if( n<0, 0, A = sum(k=1, length( binary(n+2)) - 1, x^(2^k) / (1 - x^(2^k)), x^3 * O(x^n)); polcoeff( A * (1 + x) / x^2, n))}; /* Michael Somos, May 11 2014 */
    
  • Python
    def A050603(n): return ((m:=n>>1)&~(m+1)).bit_length()+1 # Chai Wah Wu, Jul 07 2022

Formula

Equals A053398(2, n).
G.f.: (1+x)/x^2 * Sum(k>=1, x^(2^k)/(1-x^(2^k))). - Ralf Stephan, Apr 12 2002
a(n) = A136480(n+1). - Reinhard Zumkeller, Dec 31 2007
a(n) = A007814(n + 2 - n mod 2). - James Spahlinger, Oct 11 2013, corrected by Charles R Greathouse IV, Oct 14 2013
a(2n) = a(2n+1). 1 <= a(n) <= log_2(n+2). - Charles R Greathouse IV, Oct 14 2013
a(n) = A007814(n+1)+A007814(n+2).
a(n) = (-1)^n * A094267(n). - Michael Somos, May 11 2014
a(n) = A007814(floor(n/2)+1). - Chai Wah Wu, Jul 07 2022
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=0..m} a(k) = 2. - Amiram Eldar, Sep 15 2022

Extensions

Definition simplified by N. J. A. Sloane, Aug 27 2016

A377930 Square array A(n, k), n, k > 0, read by antidiagonals; A(n, k) = max(A007814(n), A007814(k)).

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 2, 1, 1, 2, 0, 2, 0, 2, 0, 1, 1, 2, 2, 1, 1, 0, 1, 0, 2, 0, 1, 0, 3, 1, 1, 2, 2, 1, 1, 3, 0, 3, 0, 2, 0, 2, 0, 3, 0, 1, 1, 3, 2, 1, 1, 2, 3, 1, 1, 0, 1, 0, 3, 0, 1, 0, 3, 0, 1, 0, 2, 1, 1, 2, 3, 1, 1, 3, 2, 1, 1, 2, 0, 2, 0, 2, 0, 3, 0, 3, 0, 2, 0, 2, 0
Offset: 1

Views

Author

Rémy Sigrist, Nov 11 2024

Keywords

Comments

Let K_0 = [0], and for any m > 0, K_m is obtained by arranging four copies of K_{m-1} around a "plus" shape made of m's as follows:
+---------+---+---------+
| | m | |
| | | |
| K_{m-1} | . | K_{m-1} |
| | . | |
| | . | |
+---+ +---------+ +---------+
K_0 = | 0 |, for m > 0, K_m = |m ... m ... m|
+---+ +---------+ +---------+
| | . | |
| | . | |
| K_{m-1} | . | K_{m-1} |
| | | |
| | m | |
+---------+---+---------+
The square array A is the limit of K_m as m tends to infinity.

Examples

			Array A(n, k) begins:
    +---+---+---+---+---+---+---+
    | 0 | 1 | 0 | 2 | 0 | 1 | 0 |
    +---+   +---+   +---+   +---+
    | 1   1   1 | 2 | 1   1   1 |
    +---+   +---+   +---+   +---+
    | 0 | 1 | 0 | 2 | 0 | 1 | 0 |
    +---+---+---+   +---+---+---+
    | 2   2   2   2   2   2   2 |
    +---+---+---+   +---+---+---+
    | 0 | 1 | 0 | 2 | 0 | 1 | 0 |
    +---+   +---+   +---+   +---+
    | 1   1   1 | 2 | 1   1   1 |
    +---+   +---+   +---+   +---+
    | 0 | 1 | 0 | 2 | 0 | 1 | 0 |
    +---+---+---+---+---+---+---+
		

Crossrefs

Programs

  • Mathematica
    A[n_,k_]:=Max[IntegerExponent[n,2],IntegerExponent[k,2]]; Table[A[n-k+1,k],{n,13},{k,n}]//Flatten (* Stefano Spezia, Nov 13 2024 *)
  • PARI
    A(n, k) = max(valuation(n, 2), valuation(k, 2))

Formula

A(n, k) = A(k, n).
A(n, 0) = A(n, n) = A007814(n).
Previous Showing 11-12 of 12 results.