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-10 of 39 results. Next

A080763 Exchange 1's and 2's in the eta-sequence A006337.

Original entry on oeis.org

2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2
Offset: 1

Views

Author

N. J. A. Sloane, Mar 25 2003

Keywords

Crossrefs

Different from A022921.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A003151 as the parent: A003151, A001951, A001952, A003152, A006337, A080763, A082844 (conjectured), A097509, A159684, A188037, A245219 (conjectured), A276862. - N. J. A. Sloane, Mar 09 2021

Programs

  • Mathematica
    Flatten[ Table[ Nest[ Flatten[ # /. {1 -> {2, 2, 1}, 2 -> {2, 1}}] &, {2}, n], {n, 5}]] (* Robert G. Wilson v, May 06 2005 *)
  • Python
    from math import isqrt
    def A080763(n): return 3+isqrt(m:=n*n<<1)-isqrt(m+(n<<2)+2) # Chai Wah Wu, Aug 03 2022

Formula

Digits := 100: c2 := sqrt(2.): A080763 := n->3-floor((n+1)*c2)+floor(n*c2);

A246140 Limiting block extension of A006337 (difference sequence of the Beatty sequence for sqrt(2)) with first term as initial block.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1
Offset: 1

Views

Author

Keywords

Comments

Suppose S = (s(0), s(1), s(2), ...) is an infinite sequence such that every finite block of consecutive terms occurs infinitely many times in S. (It is assumed that A006337 is such a sequence.) Let B = B(m,k) = (s(m), s(m+1),...s(m+k)) be such a block, where m >= 0 and k >= 0. Let m(1) be the least i > m such that (s(i), s(i+1),...,s(i+k)) = B(m,k), and put B(m(1),k+1) = (s(m(1)), s(m(1)+1),...s(m(1)+k+1)). Let m(2) be the least i > m(1) such that (s(i), s(i+1),...,s(i+k)) = B(m(1),k+1), and put B(m(2),k+2) = (s(m(2)), s(m(2)+1),...s(m(2)+k+2)). Continuing in this manner gives a sequence of blocks B'(n) = B(m(n),k+n), so that for n >= 0, B'(n+1) comes from B'(n) by suffixing a single term; thus the limit of B'(n) is defined; we call it the "limiting block extension of S with initial block B(m,k)", denoted by S^ in case the initial block is s(0).
The sequence (m(i)), where m(0) = 0, is the "index sequence for limit-block extending S with initial block B(m,k)", as in A246128. If the sequence S is given with offset 1, then the role played by s(0) in the above definitions is played by s(1) instead, as in the case of A246140 and A246141.
Limiting block extensions are analogous to limit-reverse sequences, S*, defined at A245920. The essential difference is that S^ is formed by extending each new block one term to the right, whereas S* is formed by extending each new block one term to the left (and then reversing).

Examples

			S = A006337, with B = (s(1)); that is, (m,k) = (1,0)
S = (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2,...)
B'(0) = (1)
B'(1) = (1,2)
B'(2) = (1,2,1)
B'(3) = (1,2,1,1)
B'(4) = (1,2,1,1,2)
B'(5) = (1,2,1,1,2,1)
S^ = (1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1,...),
with index sequence (1,3,6,8,15,...)
		

Crossrefs

Programs

  • Mathematica
    seqPosition1[list_, seqtofind_] := If[Length[#] > Length[list], {}, Last[Last[      Position[Partition[list, Length[#], 1], Flatten[{_, #, _}], 1, 1]]]] &[seqtofind]; s =  Differences[Table[Floor[n*Sqrt[2]], {n, 10000}]]; Take[s, 60]
    t = {{1}}; p[0] = seqPosition1[s, Last[t]]; s = Drop[s, p[0]]; Off[Last::nolast]; n = 1; While[(p[n] = seqPosition1[s, Last[t]]) > 0, (AppendTo[t, Take[s, {#, # +Length[Last[t]]}]]; s = Drop[s, #]) &[p[n]]; n++]; On[Last::nolast]; Last[t] (* A246140 *)
    Accumulate[Table[p[k], {k, 0, n - 1}]] (* A246141 *)

A378399 Rectangular array read by descending antidiagonals: (row 1) = u, and for n >= 2, (row n) = u-inverse runlength sequence of u, where u = A006337 (a Beatty difference sequence). See Comments.

Original entry on oeis.org

1, 2, 2, 1, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Clark Kimberling, Dec 21 2024

Keywords

Comments

If u and v are sequences, both consisting of 1's and 2's, we call v an inverse runlength sequence of u if u is the runlength sequence of v. Each u has two inverse runlength sequences, one with first term 1 and the other with first term 2. Consequently, an inverse runlength array, in which each row after the first is an inverse runlength sequence of the preceding row, is determined by its first column. Generally, if the first column is periodic with fundamental period p, then the array has p distinct limiting sequences; otherwise, there is no limiting sequence; however, if a segment, of any length, occurs in a row, then it also occurs in a subsequent row. See A378282 for details and related sequences.

Examples

			The corner of the array begins:
   1  2  1  2  1  1  2  1  2  1  1  2  1  2  1  2  1  1  2
   2  1  1  2  1  1  2  1  2  2  1  2  2  1  2  1  1  2  1
   1  1  2  1  2  2  1  2  1  1  2  1  1  2  2  1  2  2  1
   2  1  2  2  1  2  2  1  1  2  1  1  2  1  2  2  1  2  1
   1  1  2  1  1  2  2  1  2  2  1  1  2  1  2  2  1  2  1
   1  2  1  1  2  1  2  2  1  1  2  1  1  2  2  1  2  1  1
   2  1  1  2  1  2  2  1  2  2  1  1  2  1  2  2  1  2  1
   1  1  2  1  2  2  1  2  2  1  1  2  1  1  2  2  1  2  1
   2  1  2  2  1  2  2  1  1  2  1  1  2  2  1  2  1  1  2
   1  1  2  1  1  2  2  1  2  2  1  1  2  1  2  2  1  2  1
   1  2  1  1  2  1  2  2  1  1  2  1  1  2  2  1  2  1  1
   2  1  1  2  1  2  2  1  2  2  1  1  2  1  2  2  1  2  1
   1  1  2  1  2  2  1  2  2  1  1  2  1  1  2  2  1  2  1
		

Crossrefs

Programs

  • Mathematica
    invRE[seq_, k_] := Flatten[Map[ConstantArray[#[[2]], #[[1]]] &,
        Partition[Riffle[seq, {k, 2 - Mod[k + 1, 2]}, {2, -1, 2}], 2]]];
    row1 = Differences[Table[Floor[n*Sqrt[2]], {n, 1, 20}]] (*  A006337 );
    rows = {row1}; col = Take[row1, 12];
    Do[AppendTo[rows, Take[invRE[Last[rows], col[[n]]], Length[row1]]], {n, 2, Length[col]}]
    rows // ColumnForm  (* array *)
    w[n_, k_] := rows[[n]][[k]]; Table[w[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten (* sequence *)
    (* Peter J. C. Moses, Nov 20 2024 *)

A380560 Rectangular array R, read by descending antidiagonals: (row 1) = (R(1,k)) = (A006337(k)), k >= 1; (row n+1) = inverse runlength sequence of row n; and R(n,1) = 1 for n >=1, See Comments.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 2, 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 1
Offset: 1

Views

Author

Clark Kimberling, Jan 27 2025

Keywords

Comments

For present purposes, all sequences to be considered consist entirely of 1s and 2s. If u and v are such sequences (infinite or finite), we call v an inverse runlength sequence of u if u is the runlength sequence of v. Each u has two inverse runlength sequences, one with first term 1 and the other with first term 2. Consequently, an inverse runlength array (in which each row after the first is an inverse runlength sequence of the preceding row) is determined by its first column. In this array, the first column consists solely of 1s. No two rows are identical.
Row 1: A006337; limiting row: A000002 (Kolakoski sequence).
Guide to related sequences (arrays):
A378282, limiting sequences of periodic inverse runlength arrays
A380560, (row 1)=A006337, periodic (column 1)=(1,...)
A380561, (row 1)=A006337, periodic (column 1)=(1,1,2,...)
A380562, (row 1)=A006337, periodic (column 1)=(1,2,2,...)
A380563, (row 1)=1+A010060, periodic (column 1)=(1,...)
A378303, (ro1 1)=A006337, periodic (column 1)=(2,2,1,...)
A378396, self-inverse runlength array, u = v = 1+A010060
A378397, self-inverse runlength array, u = v = A003842
A378398, self-inverse runlength array, u = v = A014675
A378399, self-inverse runlength array, u = v = A006337

Examples

			Corner:
  1 2 1 2 1 1 2 1 2 1 1 2 1 2 1 2 1 1 2 1
  1 2 2 1 2 2 1 2 1 1 2 1 1 2 1 2 2 1 2 2
  1 2 2 1 1 2 1 1 2 2 1 2 2 1 2 1 1 2 1 2
  1 2 2 1 1 2 1 2 2 1 2 1 1 2 2 1 2 2 1 1
  1 2 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 2 1 2
  1 2 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 2 2 1
  1 2 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 2 2 1
		

Crossrefs

Cf. A000002, A000012 (column 1), A006337.

Programs

  • Mathematica
    invR[seq_] := Flatten[Map[ConstantArray[#[[2]], #[[1]]] &,
        Partition[Riffle[seq, {1, 2}, {2, -1, 2}], 2]]];
    s = Differences[Table[Floor[n*Sqrt[2]], {n, 1, 21}]]; (* A006337 *)
    t = NestList[invR, s, 12];
    u[n_] := Take[t[[n]], 20];
    Table[u[n], {n, 1, 12}]  (* array *)
    v[n_, k_] := t[[n]][[k]];
    Table[v[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten (* sequence *)
    (* Peter J. C. Moses, Nov 13 2024 *)

A245933 Limit-reverse of A006337 (the difference sequence of Beatty sequence for sqrt(2)), with first term as initial block.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1
Offset: 1

Views

Author

Keywords

Comments

Suppose S = (s(0), s(1), s(2), ...) is an infinite sequence such that every finite block of consecutive terms occurs infinitely many times in S. (It is assumed that A006337 is such a sequence.) Let B = B(m,k) = (s(m-k), s(m-k+1),...,s(m)) be such a block, where m >= 0 and k >= 0. Let m(1) be the least i > m such that (s(i-k), s(i-k+1),...,s(i)) = B(m,k), and put B(m(1),k+1) = (s(m(1)-k-1), s(m(1)-k),...,s(m(1))). Let m(2) be the least i > m(1) such that (s(i-k-1), s(i-k),...,s(i)) = B(m(1),k+1), and put B(m(2),k+2) = (s(m(2)-k-2), s(m(2)-k-1),...,s(m(2))). Continuing in this manner gives a sequence of blocks B(m(n),k+n). Let B'(n) = reverse(B(m(n),k+n)), so that for n >= 1, B'(n) comes from B'(n-1) by suffixing a single term; thus the limit of B'(n) is defined; we call it the "limit-reverse of S with initial block B(m,k)", denoted by S*(m,k), or simply S*. (Since Beatty sequences are usually written with offset 1, the above definition is adapted accordingly, so that s(n) = A006337(n+1) for n >= 0.)
...
The sequence (m(i)), where m(0) = 1, is the "index sequence for limit-reversing S with initial block B(m,k)" or simply the index sequence for S*, as in A245934.

Examples

			S = A006337 (re-indexed to start with s(0) = 1, with B = (s(0)); that is, (m,k) = (0,0)
S = (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2,...)
B'(0) = (1)
B'(1) = (2,1)
B'(2) = (1,2,1)
B'(3) = (1, 2, 1, 1)
B'(4) = (1, 2, 1, 1, 2)
B'(5) = (1, 2, 1, 1, 2, 1)
S* = (1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1,...),
with index sequence (1, 3, 5, 8, 13, 20, 25, 32, 37,...)
		

Crossrefs

Programs

  • Mathematica
    z = 100; seqPosition2[list_, seqtofind_] := Last[Last[Position[Partition[list, Length[#], 1], Flatten[{_, #, _}], 1, 2]]] &[seqtofind]; x = Sqrt[2]; s = Differences[Table[Floor[n*x], {n, 1, z^2}]] ; ans = Join[{s[[p[0] = pos = seqPosition2[s, #] - 1]]}, #] &[{s[[1]]}]; cfs = Table[s = Drop[s, pos - 1]; ans = Join[{s[[p[n] = pos = seqPosition2[s, #] - 1]]}, #] &[ans], {n, z}]; rcf = Last[Map[Reverse, cfs]]

A245934 Index sequence for limit-reversing the A006337; see Comments.

Original entry on oeis.org

1, 3, 5, 8, 13, 20, 25, 32, 37, 42, 54, 66, 71, 83, 95, 107, 124, 136, 153, 165, 177, 194, 206, 223, 235, 252, 293, 322, 363, 392, 421, 462, 491, 532, 561, 602, 631, 660, 701, 730, 771, 800, 829, 870, 899, 940, 969, 1010, 1039, 1068, 1109, 1138, 1179, 1208
Offset: 1

Views

Author

Keywords

Comments

Suppose S = (s(0), s(1), s(2),...) is an infinite sequence such that every finite block of consecutive terms occurs infinitely many times in S. (It is assumed that A006337 is such a sequence.) Let B = B(m,k) = (s(m-k), s(m-k+1),...,s(m)) be such a block, where m >= 0 and k >= 0. Let m(1) be the least i > m such that (s(i-k), s(i-k+1),...,s(i)) = B(m,k), and put B(m(1),k+1) = (s(m(1)-k-1), s(m(1)-k),...,s(m(1))). Let m(2) be the least i > m(1) such that (s(i-k-1), s(i-k),...,s(i)) = B(m(1),k+1), and put B(m(2),k+2) = (s(m(2)-k-2), s(m(2)-k-1),...,s(m(2))). Continuing in this manner gives a sequence of blocks B(m(n),k+n). Let B'(n) = reverse(B(m(n),k+n)), so that for n >= 1, B'(n) comes from B'(n-1) by suffixing a single term; thus the limit of B'(n) is defined; we call it the "limit-reverse of S with initial block B(m,k)", denoted by S*(m,k), or simply S*. (Since Beatty sequences are usually written with offset 1, the above definition is adapted accordingly, so that s(n) = A006337(n+1) for n >= 0.)
...
The sequence (m(i)), where m(0) = 1, is the "index sequence for limit-reversing S with initial block B(m,k)" or simply the index sequence for S*, as in A245934.

Examples

			S = A006337 (re-indexed to start with s(0) = 1, with B = (s(0)); that is, (m,k) = (0,0); S = (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2,...)
B'(0) = (1)
B'(1) = (2,1)
B'(2) = (1,2,1)
B'(3) = (1, 2, 1, 1)
B'(4) = (1, 2, 1, 1, 2)
B'(5) = (1, 2, 1, 1, 2, 1)
S* = (1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1,...),
with index sequence (1, 3, 5, 8, 13, 20, 25, 32, 37,...)
		

Crossrefs

Programs

  • Mathematica
    z = 140; seqPosition2[list_, seqtofind_] := Last[Last[Position[Partition[list, Length[#], 1], Flatten[{_, #, _}], 1, 2]]] &[seqtofind]; x = Sqrt[2]; s =  Differences[Table[Floor[n*x], {n, 1, z^2}]];  ans = Join[{s[[p[0] = pos = seqPosition2[s, #] - 1]]}, #] &[{s[[1]]}]; cfs = Table[s = Drop[s, pos - 1]; ans = Join[{s[[p[n] = pos = seqPosition2[s, #] - 1]]}, #] &[ans], {n, z}]; q = Accumulate[Join[{1}, Table[p[n], {n, 0, z}]]]  (* A245934 *)
    q1 = Differences[q]  (* A245935 *)

A246141 Index sequence for limit-block extending A006337 (difference sequence of the Beatty sequence for sqrt(2)) with first term as initial block.

Original entry on oeis.org

1, 3, 6, 8, 15, 20, 27, 32, 37, 49, 66, 78, 90, 107, 119, 136, 148, 160, 177, 189, 206, 235, 247, 276, 305, 317, 346, 375, 404, 416, 445, 474, 486, 515, 556, 585, 614, 655, 684, 725, 754, 783, 824, 853, 894, 923, 964, 993, 1022, 1063, 1092, 1133, 1162, 1191
Offset: 1

Views

Author

Keywords

Comments

Suppose S = (s(0), s(1), s(2), ...) is an infinite sequence such that every finite block of consecutive terms occurs infinitely many times in S. (It is assumed that A006337 is such a sequence.) Let B = B(m,k) = (s(m), s(m+1),...s(m+k)) be such a block, where m >= 0 and k >= 0. Let m(1) be the least i > m such that (s(i), s(i+1),...,s(i+k)) = B(m,k), and put B(m(1),k+1) = (s(m(1)), s(m(1)+1),...s(m(1)+k+1)). Let m(2) be the least i > m(1) such that (s(i), s(i+1),...,s(i+k)) = B(m(1),k+1), and put B(m(2),k+2) = (s(m(2)), s(m(2)+1),...s(m(2)+k+2)). Continuing in this manner gives a sequence of blocks B'(n) = B(m(n),k+n), so that for n >= 0, B'(n+1) comes from B'(n) by suffixing a single term; thus the limit of B'(n) is defined; we call it the "limiting block extension of S with initial block B(m,k)", denoted by S^ in case the initial block is s(0).
The sequence (m(i)), where m(0) = 0, is the "index sequence for limit-block extending S with initial block B(m,k)", as in A246128. If the sequence S is given with offset 1, then the role played by s(0) in the above definitions is played by s(1) instead, as in the case of A246140 and A246141.
Limiting block extensions are analogous to limit-reverse sequences, S*, defined at A245920. The essential difference is that S^ is formed by extending each new block one term to the right, whereas S* is formed by extending each new block one term to the left (and then reversing).

Examples

			S = A006337, with B = (s(1)); that is, (m,k) = (1,0)
S = (1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 2,...)
B'(0) = (1)
B'(1) = (1,2)
B'(2) = (1,2,1)
B'(3) = (1,2,1,1)
B'(4) = (1,2,1,1,2)
B'(5) = (1,2,1,1,2,1)
S^ = (1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1,...),
with index sequence (1,3,6,8,15,...)
		

Crossrefs

Programs

  • Mathematica
    seqPosition1[list_, seqtofind_] := If[Length[#] > Length[list], {}, Last[Last[      Position[Partition[list, Length[#], 1], Flatten[{_, #, _}], 1, 1]]]] &[seqtofind]; s =  Differences[Table[Floor[n*Sqrt[2]], {n, 10000}]]; Take[s, 60]
    t = {{1}}; p[0] = seqPosition1[s, Last[t]]; s = Drop[s, p[0]]; Off[Last::nolast]; n = 1; While[(p[n] = seqPosition1[s, Last[t]]) > 0, (AppendTo[t, Take[s, {#, # +Length[Last[t]]}]]; s = Drop[s, #]) &[p[n]]; n++]; On[Last::nolast]; Last[t] (* A246140 *)
    Accumulate[Table[p[k], {k, 0, n - 1}]] (* A246141 *)

A380561 Rectangular array R read by descending antidiagonals: (row 1) = (R(1,k)) = (A006337(k)), k >= 1; (row n+1) = inverse runlength sequence of row n; and R(n,1) = (1, 1, 2, 1, 1, 2, 1, 1, 2, ...) = (A100063(n)) for n >= 1. See Comments.

Original entry on oeis.org

1, 2, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2
Offset: 1

Views

Author

Clark Kimberling, Jan 27 2025

Keywords

Comments

For present purposes, all sequences to be considered consist entirely of 1s and 2s. If u and v are such sequences (infinite or finite), we call v an inverse runlength sequence of u if u is the runlength sequence of v. Each u has two inverse runlength sequences, one with first term 1 and the other with first term 2. Consequently, an inverse runlength array (in which each row after the first is an inverse runlength sequence of the preceding row) is determined by its first column. In this array, the first column is the periodic sequence with period 1,1,2. There are three limiting sequences: A378283, A378284, A378285. No two rows are identical.
See A380560 for a guide to related sequences.

Examples

			Corner:
    1  2  1  2  1  1  2  1  2  1  1  2  1  2  1  2  1  1  2
    1  2  2  1  2  2  1  2  1  1  2  1  1  2  1  2  2  1  2
    2  1  1  2  2  1  2  2  1  1  2  1  1  2  1  2  2  1  2
    1  1  2  1  2  2  1  1  2  1  1  2  2  1  2  1  1  2  1
    1  2  1  1  2  1  1  2  2  1  2  1  1  2  1  2  2  1  1
    2  1  1  2  1  2  2  1  2  1  1  2  2  1  2  2  1  2  1
    1  1  2  1  2  2  1  2  2  1  1  2  1  1  2  1  2  2  1
    1  2  1  1  2  1  1  2  2  1  2  2  1  1  2  1  2  2  1
    2  1  1  2  1  2  2  1  2  1  1  2  2  1  2  2  1  1  2
		

Crossrefs

Cf. A000002, A100063 (column 1), A006337, A380560.

Programs

  • Mathematica
    invRE[seq_, k_] := Flatten[Map[ConstantArray[#[[2]], #[[1]]] &,
        Partition[Riffle[seq, {k, 2 - Mod[k + 1, 2]}, {2, -1, 2}], 2]]];
    row1 = Flatten[Table[Nest[Flatten[# /. {1 -> {1, 2}, 2 -> {1, 1, 2}}] &, {1},  n], {n, 3}]];(* A006337 *)
    rows = {row1};
    col = PadRight[{}, 30, {1, 1, 2}];
    Do[AppendTo[rows, Take[invRE[Last[rows], col[[n]]], Length[row1]]], {n, 2, Length[col]}]
    rows // ColumnForm  (* array *)
    v[n_, k_] := rows[[n]][[k]];
    Table[v[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten (*sequence*)
    (* Peter J. C. Moses, Nov 20 2024 *)

A380562 Rectangular array R read by descending antidiagonals: (row 1) = (R(1,k)) = (A006337(k)), k >= 1; (row n+1) = inverse runlength sequence of row n; and R(n,1) = (1, 2, 2, 1, 2, 2, 1, 2, 2, ...) = (A130196(n)) for n >= 1. See Comments.

Original entry on oeis.org

1, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2
Offset: 1

Views

Author

Clark Kimberling, Jan 27 2025

Keywords

Comments

For present purposes, all sequences to be considered consist entirely of 1s and 2s. If u and v are such sequences (infinite or finite), we call v an inverse runlength sequence of u if u is the runlength sequence of v. Each u has two inverse runlength sequences, one with first term 1 and the other with first term 2. Consequently, an inverse runlength array (in which each row after the first is an inverse runlength sequence of the preceding row) is determined by its first column. In this array, the first column is the periodic sequence with period 1,1,2. There are three limiting sequences: A378283, A378284, A378285. No two rows are identical.
See A380560 for a guide to related sequences.

Examples

			Corner:
    1  2  1  2  1  1  2  1  2  1  1  2  1  2  1  2  1  1  2
    2  1  1  2  1  1  2  1  2  2  1  2  2  1  2  1  1  2  1
    2  2  1  2  1  1  2  1  2  2  1  2  2  1  1  2  1  1  2
    1  1  2  2  1  2  2  1  2  1  1  2  1  1  2  2  1  2  2
    2  1  2  2  1  1  2  1  1  2  2  1  2  2  1  2  1  1  2
    2  2  1  2  2  1  1  2  1  2  2  1  2  1  1  2  2  1  2
    1  1  2  2  1  2  2  1  1  2  1  2  2  1  2  2  1  1  2
    2  1  2  2  1  1  2  1  1  2  2  1  2  1  1  2  1  1  2
    2  2  1  2  2  1  1  2  1  2  2  1  2  1  1  2  2  1  2
    1  1  2  2  1  2  2  1  1  2  1  2  2  1  2  2  1  1  2
		

Crossrefs

Cf. A000002, A130196 (column 1), A006337, A380560.

Programs

  • Mathematica
    invRE[seq_, k_] := Flatten[Map[ConstantArray[#[[2]], #[[1]]] &,
        Partition[Riffle[seq, {k, 2 - Mod[k + 1, 2]}, {2, -1, 2}], 2]]];
    row1 = Flatten[Table[Nest[Flatten[# /. {1 -> {1, 2}, 2 -> {1, 1, 2}}] &, {1}, n], {n, 3}]]; (* A006337 *)
    rows = {row1};
    col = PadRight[{}, 30, {1, 2, 2}];
    Do[AppendTo[rows, Take[invRE[Last[rows], col[[n]]], Length[row1]]], {n, 2, Length[col]}]
    rows // ColumnForm  (* array *)
    v[n_, k_] := rows[[n]][[k]];
    Table[v[n - k + 1, k], {n, 12}, {k, n, 1, -1}] // Flatten (*sequence*)
    (* Peter J. C. Moses, Nov 20 2024 *)

A001951 A Beatty sequence: a(n) = floor(n*sqrt(2)).

Original entry on oeis.org

0, 1, 2, 4, 5, 7, 8, 9, 11, 12, 14, 15, 16, 18, 19, 21, 22, 24, 25, 26, 28, 29, 31, 32, 33, 35, 36, 38, 39, 41, 42, 43, 45, 46, 48, 49, 50, 52, 53, 55, 56, 57, 59, 60, 62, 63, 65, 66, 67, 69, 70, 72, 73, 74, 76, 77, 79, 80, 82, 83, 84, 86, 87, 89, 90, 91, 93, 94, 96, 97, 98, 100
Offset: 0

Views

Author

Keywords

Comments

Earliest monotonic sequence greater than 0 satisfying the condition: "a(n) + 2n is not in the sequence". - Benoit Cloitre, Mar 25 2004
Also the integer part of the hypotenuse of isosceles right triangles. The real part of these numbers is irrational. For proof see Jones and Jones.
First differences are 1, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, ... (A006337 with a 1 in front). - Philippe Deléham, May 29 2006
It appears that the distance between the a(n)-th triangular number and the nearest square is not greater than floor(a(n)/2). - Ralf Stephan, Sep 14 2013
These are the nonnegative integers m satisfying sin(m*Pi/r)*sin((m+1)*Pi/r) <= 0, where r = sqrt(2). In general, the Beatty sequence of an irrational number r > 1 consists of the numbers m satisfying sin(m*x)*sin((m+1)*x) <= 0, where x = Pi/r. Thus the numbers m satisfying sin(m*x)*sin((m+1)*x) > 0 form the Beatty sequence of r/(1-r). - Clark Kimberling, Aug 21 2014
For n > 0: A080764(a(n)) = 1. - Reinhard Zumkeller, Jul 03 2015
From Clark Kimberling, Oct 17 2016: (Start)
We can generate A001951 and A001952 without using sqrt(2).
First write the even positive integers in a row:
2 4 6 8 10 12 14 . . .
Then put 1 under 2 and add:
2 4 6 8 10 12 14 . . .
1
3
Next, under 4, put the least positive integer that is not yet in rows 2 and 3;
it is 2; and add:
2 4 6 8 10 12 14 . . .
1 2
3 6
Next, under the 6 in row 1, put the least positive integer not yet in rows 2 and 3;
it is 4, and add:
2 4 6 8 10 12 14 . . .
1 2 4
3 6 10
Continue in this manner. (End)
This sequence contains an infinite number of powers of 2 (proof in Crux Mathematicorum link). See A103341. - Bernard Schott, Mar 08 2019
The terms of this sequence generate the multiplicative group of positive rational numbers (observation by Stephen M. Gagola, Jr.; see References). - Allen Stenger, Aug 05 2023
a(n) is also the number of distinct straight cylinders with integer radius and height having the same surface as a sphere with radius n. - Felix Huber, Sep 20 2024
Let P(x,y) be the condition x^2 + y^2 <= n^2, then 4*a(n) is the number of integer points (x,y) such that P(x,y) is true and at least one of P(x+1,y), P(x-1,y), P(x,y+1), P(x,y-1) is false. See LINKS for examples. - Bob de Boisvilliers, May 14 2025

References

  • Eric DuchĂȘne, Aviezri S. Fraenkel, Vladimir Gurvich, Nhan Bao Ho, Clark Kimberling, Urban Larsson, Wythoff Visions, Games of No Chance, Vol. 5; MSRI Publications, Vol. 70 (2017), pages 101-153.
  • Stephen M. Gagola Jr., Solution of Problem 12282, Am. Math. Monthly, 130 (2023), pp. 682-683.
  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 77.
  • Gareth A. Jones and J. Mary Jones, Elementary Number Theory, Springer, 1998; pp. 221-222.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Roland Sprague, Recreations in Mathematics, Blackie and Son, (1963).
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, Revised edition (1997), Entry sqrt(2), p. 18.

Crossrefs

Complement of A001952. Equals A001952(n) - 2*n for n>0.
Equals A003151(n) - n; a bisection of A094077.
Bisections: A022842, A342281.
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A003151 as the parent: A003151, A001951, A001952, A003152, A006337, A080763, A082844 (conjectured), A097509, A159684, A188037, A245219 (conjectured), A276862. - N. J. A. Sloane, Mar 09 2021
Partial sums: A194102.

Programs

  • Haskell
    a001951 = floor . (* sqrt 2) . fromIntegral
    -- Reinhard Zumkeller, Sep 14 2014
    
  • Magma
    [Floor(n*Sqrt(2)): n in [0..60]]; // Vincenzo Librandi, Oct 22 2011
    
  • Magma
    [Isqrt(2*n^2):n in[0..60]]; // Jason Kimberley, Oct 28 2016
    
  • Maple
    a:=n->floor(n*sqrt(2)): seq(a(n),n=0..80); # Muniru A Asiru, Mar 09 2019
  • Mathematica
    Floor[Range[0, 72] Sqrt[2]] (* Robert G. Wilson v, Oct 17 2012 *)
  • Maxima
    makelist(floor(n*sqrt(2)), n, 0, 100); /* Martin Ettl, Oct 17 2012 */
    
  • PARI
    f(n) = for(j=1,n,print1(floor(sqrt(2*j^2))","))
    
  • PARI
    a(n)=sqrtint(2*n^2) \\ Charles R Greathouse IV, Oct 19 2016
    
  • Python
    from sympy import integer_nthroot
    def A001951(n): return integer_nthroot(2*n**2,2)[0] # Chai Wah Wu, Mar 16 2021

Formula

a(n) = A000196(A001105(n)). - Jason Kimberley, Oct 26 2016
a(n) = floor(csc(1/(sqrt(2)*n))) for n > 0, since sqrt(2)*n < csc(1/(sqrt(2)*n)) < sqrt(2)*n + 1/(3*sqrt(2)*n) < floor(sqrt(2)*n) + 1 for n > 0. - Jianing Song, Sep 07 2021
a(n) = A194102(n) - A194102(n-1) for n > 0. - M. F. Hasler, Apr 23 2022

Extensions

More terms from David W. Wilson, Sep 20 2000
Showing 1-10 of 39 results. Next