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 14 results. Next

A038718 Number of permutations P of {1,2,...,n} such that P(1)=1 and |P^-1(i+1)-P^-1(i)| equals 1 or 2 for i=1,2,...,n-1.

Original entry on oeis.org

1, 1, 2, 4, 6, 9, 14, 21, 31, 46, 68, 100, 147, 216, 317, 465, 682, 1000, 1466, 2149, 3150, 4617, 6767, 9918, 14536, 21304, 31223, 45760, 67065, 98289, 144050, 211116, 309406, 453457, 664574, 973981, 1427439, 2092014, 3065996, 4493436, 6585451
Offset: 1

Views

Author

John W. Layman, May 02 2000

Keywords

Comments

This sequence is the number of digits of each term of A061583. - Dmitry Kamenetsky, Jan 17 2009

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{2,-1,1,-1},{1,1,2,4},50] (* or *) CoefficientList[ Series[(x^2-x+1)/(x^4-x^3+x^2-2x+1),{x,0,50}],x] (* Harvey P. Dale, Apr 24 2011 *)
  • PARI
    a(n)=([0,1,0,0; 0,0,1,0; 0,0,0,1; -1,1,-1,2]^(n-1)*[1;1;2;4])[1,1] \\ Charles R Greathouse IV, Apr 07 2016

Formula

From Joseph Myers, Feb 03 2004: (Start)
G.f.: (1 -x +x^2)/(1-2*x+x^2-x^3+x^4).
a(n) = a(n-1) + a(n-3) + 1. (End)
a(n) = Sum_{i=1..n} A058278(i) = A097333(n) - 1. - R. J. Mathar, Oct 16 2010

Extensions

More terms from Joseph Myers, Feb 03 2004

A097333 a(n) = Sum_{k=0..n} C(n-k, floor(k/2)).

Original entry on oeis.org

1, 2, 2, 3, 5, 7, 10, 15, 22, 32, 47, 69, 101, 148, 217, 318, 466, 683, 1001, 1467, 2150, 3151, 4618, 6768, 9919, 14537, 21305, 31224, 45761, 67066, 98290, 144051, 211117, 309407, 453458, 664575, 973982, 1427440, 2092015, 3065997, 4493437, 6585452
Offset: 0

Views

Author

Paul Barry, Aug 05 2004

Keywords

Comments

Partial sums of A058278.

Crossrefs

Essentially the same as A003410 and A058278.

Programs

Formula

G.f.: (1+x-x^2-x^3)/((1-x)*(1-x^2-x^3-x^4)) = (1+x)/(1-x-x^3);
a(n) = a(n-1) + a(n-3);
a(n) = a(n-1) + a(n-2) - a(n-5).
a(n) = A058278(n+3) = A000930(n-1)+A000930(n). - R. J. Mathar, Jul 07 2023
a(n) = A003410(n-1) for n >= 2. - Jianing Song, Aug 11 2023

A226130 Denominators of rational numbers as generated by the rules: 1 is in S, and if nonzero x is in S, then x+1 and -1/x are in S. (See Comments.)

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 2, 1, 4, 3, 2, 1, 1, 5, 4, 3, 2, 2, 3, 1, 6, 5, 4, 3, 3, 5, 2, 5, 3, 1, 7, 6, 5, 4, 4, 7, 3, 8, 5, 2, 7, 5, 3, 1, 1, 8, 7, 6, 5, 5, 9, 4, 11, 7, 3, 11, 8, 5, 2, 2, 9, 7, 5, 3, 3, 4, 1, 9, 8, 7, 6, 6, 11, 5, 14, 9, 4, 15, 11, 7, 3, 3
Offset: 1

Views

Author

Clark Kimberling, May 28 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 1 is in S, and if nonzero x is in S, then x + 1 and -1/x are in S. Then S is the set of all rational numbers, produced in generations as follows: g(1) = (1), g(2) = (2, -1), g(3) = (3, -1/2, 0), g(4) = (4, -1/3, 1/2), ... For n > 4, once g(n-1) = (c(1), ..., c(z)) is defined, g(n) is formed from the vector (c(1)+1, -1/c(1), c(2)+1, -1/c(2), ..., c(z)+1, -1/c(z)) by deleting previously generated elements. Let S' denote the sequence formed by concatenating the generations.
A226130: Denominators of terms of S'
A226131: Numerators of terms of S'
A226136: Positions of positive integers in S'
A226137: Positions of integers in S'
The length of row n is given by A226275(n-1). - Peter Kagey, Jan 17 2022

Examples

			The denominators and numerators are read from the rationals in S':
  1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...
Table begins:
  n |
  --+-----------------------------------------------
  1 | 1;
  2 | 1, 1;
  3 | 1, 2, 1;
  4 | 1, 3, 2;
  5 | 1, 4, 3, 2, 1;
  6 | 1, 5, 4, 3, 2, 2, 3;
  7 | 1, 6, 5, 4, 3, 3, 5, 2, 5, 3;
  8 | 1, 7, 6, 5, 4, 4, 7, 3, 8, 5, 2, 7, 5, 3, 1;
		

Crossrefs

Cf. A226080 (rabbit ordering of positive rationals).
Cf. A226247 (analogous with "0 is in S").

Programs

  • Mathematica
    g[1] := {1}; z = 20; g[n_] := g[n] = DeleteCases[Flatten[Transpose[{# + 1, -1/#}]]&[DeleteCases[g[n - 1], 0]], Apply[Alternatives, Flatten[Map[g, Range[n - 1]]]]]; Flatten[Map[g, Range[7]]]  (* ordered rationals *)
    Map[g, Range[z]]; Table[Length[g[i]], {i, 1, z}] (* cf. A003410 *)
    f = Flatten[Map[g, Range[z]]];
    Take[Denominator[f], 100] (* A226130 *)
    Take[Numerator[f], 100]   (* A226131 *)
    p1 = Flatten[Table[Position[f, n], {n, 1, z}]] (* A226136 *)
    p2 = Flatten[Table[Position[f, -n], {n, 0, z}]];
    Union[p1, p2]  (* A226137 *)  (* Peter J. C. Moses, May 26 2013 *)
  • Python
    from fractions import Fraction
    from itertools import count, islice
    def agen():
        rats = [Fraction(1, 1)]
        seen = {Fraction(1, 1)}
        for n in count(1):
            yield from [r.denominator for r in rats]
            newrats = []
            for r in rats:
                f = 1+r
                if f not in seen:
                    newrats.append(1+r)
                    seen.add(f)
                if r != 0:
                    g = -1/r
                    if g not in seen:
                        newrats.append(-1/r)
                        seen.add(g)
            rats = newrats
    print(list(islice(agen(), 84))) # Michael S. Branicky, Jan 17 2022

A058278 Expansion of (1 - x^2)/(1 - x - x^3).

Original entry on oeis.org

1, 1, 0, 1, 2, 2, 3, 5, 7, 10, 15, 22, 32, 47, 69, 101, 148, 217, 318, 466, 683, 1001, 1467, 2150, 3151, 4618, 6768, 9919, 14537, 21305, 31224, 45761, 67066, 98290, 144051, 211117, 309407, 453458, 664575, 973982, 1427440, 2092015, 3065997, 4493437
Offset: 0

Views

Author

Robert G. Wilson v, Dec 06 2000

Keywords

Crossrefs

Essentially the same as A003410 and A097333.
Cf. A000930.

Programs

Formula

G.f.: (1 - x^2)/(1 - x - x^3).
a(n+3) = Sum_{k=0..n} binomial(n-k, floor(k/2)). - Paul Barry, Jul 06 2004
a(n) = a(n-3) + a(n-1). - Graeme McRae, Apr 26 2010
From Wolfdieter Lang, Apr 21 2015 : (Start)
a(n) = A097333(n-3), n >= 3.
a(n) = A000930(n) - A000930(n-2), n >= 2. (End)
a(n) = A003410(n-4) for n >= 5. - Jianing Song, Aug 11 2023

Extensions

Edited: Offset corrected to 0. The formula by P. Barry corrected. Old formulas adapted to new offset. - Wolfdieter Lang, Apr 21 2015

A226131 Numerators of rational numbers as generated by the rules: 1 is in S, and if nonzero x is in S, then x+1 and -1/x are in S. (See Comments.)

Original entry on oeis.org

1, 2, -1, 3, -1, 0, 4, -1, 1, 5, -1, 2, 3, -2, 6, -1, 3, 5, -3, 5, -2, 7, -1, 4, 7, -4, 8, -3, 7, -2, 1, 8, -1, 5, 9, -5, 11, -4, 11, -3, 2, 9, -2, 3, 4, -3, 9, -1, 6, 11, -6, 14, -5, 15, -4, 3, 14, -3, 5, 7, -5, 11, -2, 5, 8, -5, 7, -3, 10, -1, 7, 13, -7
Offset: 1

Views

Author

Clark Kimberling, May 28 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 1 is in S, and if nonzero x is in S, then x + 1 and -1/x are in S. Then S is the set of all rational numbers, produced in generations as follows: g(1) = (1), g(2) = (2, -1), g(3) = (3, -1/2, 0), g(4) = (4, -1/3, 1/2), ... For n > 4, once g(n-1) = (c(1), ..., c(z)) is defined, g(n) is formed from the vector (c(1)+1, -1/c(1), c(2)+1, -1/c(2), ..., c(z)+1, -1/c(z)) by deleting previously generated elements.
Let S' denote the sequence formed by concatenating the generations.
A226130: Denominators of terms of S'
A226131: Numerators of terms of S'
A226136: Positions of positive integers in S'
A226137: Positions of integers in S'

Examples

			Rationals in S': 1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...
		

Crossrefs

Cf. A226080 (rabbit ordering of positive rationals), A226247.

Programs

  • Mathematica
    g[1] := {1}; z = 20; g[n_] := g[n] = DeleteCases[Flatten[Transpose[{# + 1, -1/#}]]&[DeleteCases[g[n - 1], 0]], Apply[Alternatives, Flatten[Map[g, Range[n - 1]]]]]; Flatten[Map[g, Range[7]]]  (* ordered rationals *)
    Map[g, Range[z]]; Table[Length[g[i]], {i, 1, z}] (* cf A003410 *)
    f = Flatten[Map[g, Range[z]]];
    Take[Denominator[f], 100] (* A226130 *)
    Take[Numerator[f], 100]    (* A226131 *)
    p1 = Flatten[Table[Position[f, n], {n, 1, z}]] (* A226136 *)
    p2 = Flatten[Table[Position[f, -n], {n, 0, z}]];
    Union[p1, p2]  (* A226137 *) (* Peter J. C. Moses, May 26 2013 *)

A101399 a(0) = 1, a(1) = 2, a(2) = 5; for n >= 3, a(n) = a(n-1) + 2*a(n-2) + a(n-3).

Original entry on oeis.org

1, 2, 5, 10, 22, 47, 101, 217, 466, 1001, 2150, 4618, 9919, 21305, 45761, 98290, 211117, 453458, 973982, 2092015, 4493437, 9651449, 20730338, 44526673, 95638798, 205422482, 441226751, 947710513, 2035586497, 4372234274
Offset: 0

Views

Author

Jeroen F.J. Laros, Jan 15 2005

Keywords

Comments

Lengths of successive words (starting with a) under the substitution: {a -> ab, b -> aac, c -> a}.

Crossrefs

Pairwise sums of A078007. Bisection of A003410 and A058278.

Programs

  • GAP
    a:=[1,2,5];; for n in [4..35] do a[n]:=a[n-1]+2*a[n-2]+a[n-3]; od; a; # Muniru A Asiru, Apr 03 2018
  • Magma
    I:=[1,2,5]; [n le 3 select I[n] else Self(n-1) + 2*Self(n-2) + Self(n-3): n in [1..30]]; // G. C. Greubel, Apr 03 2018
    
  • Magma
    m:=25; R:=PowerSeriesRing( Integers(), m); Coefficients(R!((1+x+x^2)/(1-x-2*x^2-x^3))); // G. C. Greubel, Apr 03 2018
    
  • Mathematica
    a[0] = 1; a[1] = 2; a[2] = 5; a[n_] := a[n] = a[n - 1] + 2a[n - 2] + a[n - 3]; Table[ a[n], {n, 0, 30}] (* Robert G. Wilson v, Jan 15 2005 *)
    LinearRecurrence[{1,2,1},{1,2,5},30] (* Harvey P. Dale, Aug 29 2012 *)
    CoefficientList[Series[(1+x+x^2)/(1-x-2*x^2-x^3), {x, 0, 50}], x] (* G. C. Greubel, Apr 03 2018 *)
  • PARI
    x='x+O('x^30); Vec((1+x+x^2)/(1-x-2*x^2-x^3)) \\ G. C. Greubel, Apr 03 2018
    

Formula

G.f.: (1+x+x^2)/(1-x-2*x^2-x^3). - G. C. Greubel, Apr 03 2018

Extensions

More terms from Robert G. Wilson v and Lior Manor, Jan 15 2005

A226136 Positions of the positive integers in the ordering of rational numbers as generated by the rules: 1 is in S, and if nonzero x is in S, then x+1 and -1/x are in S. (See Comments.)

Original entry on oeis.org

1, 2, 4, 7, 10, 15, 22, 32, 47, 69, 101, 148, 217, 318, 466, 683, 1001, 1467, 2150, 3151, 4618, 6768, 9919, 14537, 21305, 31224, 45761, 67066, 98290, 144051, 211117, 309407, 453458, 664575, 973982
Offset: 1

Views

Author

Clark Kimberling, May 28 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 1 is in S, and if nonzero x is in S, then x + 1 and -1/x are in S. Then S is the set of all rational numbers, produced in generations as follows: g(1) = (1), g(2) = (2, -1), g(3) = (3, -1/2, 0), g(4) = (4, -1/3, 1/2), ... For n > 4, once g(n-1) = (c(1), ..., c(z)) is defined, g(n) is formed from the vector (c(1)+1, -1/c(1), c(2)+1, -1/c(2), ..., c(z)+1, -1/c(z)) by deleting previously generated elements. Let S' denote the sequence formed by concatenating the generations.
A226130: Denominators of terms of S'
A226131: Numerators of terms of S'
A226136: Positions of positive integers in S'
A226137: Positions of integers in S'

Examples

			S' = (1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...), with positive integers appearing in positions 1,2,4,7,...
		

Crossrefs

Cf. A226080 (rabbit ordering of positive rationals).

Programs

  • Mathematica
    g[1] := {1}; z = 20; g[n_] := g[n] = DeleteCases[Flatten[Transpose[{# + 1, -1/#}]]&[DeleteCases[g[n - 1], 0]], Apply[Alternatives, Flatten[Map[g, Range[n - 1]]]]]; Flatten[Map[g, Range[7]]]  (* ordered rationals *)
    Map[g, Range[z]]; Table[Length[g[i]], {i, 1, z}] (* cf A003410 *)
    f = Flatten[Map[g, Range[z]]];
    Take[Denominator[f], 100] (* A226130 *)
    Take[Numerator[f], 100]   (* A226131 *)
    p1 = Flatten[Table[Position[f, n], {n, 1, z}]] (* A226136 *)
    p2 = Flatten[Table[Position[f, -n], {n, 0, z}]];
    Union[p1, p2]  (* A226137 *) (* Peter J. C. Moses, May 26 2013 *)

Formula

Conjecture: a(n) = a(n-1)+a(n-3) for n>6. G.f.: -x*(x+1) * (x^2+1)^2 / (x^3+x-1). - Colin Barker, Jul 03 2013

A226137 Positions of the integers in the ordering of rational numbers as generated by the rules: 1 is in S, and if nonzero x is in S, then x+1 and -1/x are in S. (See Comments.)

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 10, 14, 15, 22, 32, 46, 47, 69, 101, 147, 148, 217, 318, 465, 466, 683, 1001, 1466, 1467, 2150, 3151, 4617, 4618, 6768, 9919, 14536, 14537, 21305, 31224, 45760, 45761, 67066, 98290, 144050, 144051, 211117, 309407, 453457, 453458
Offset: 1

Views

Author

Clark Kimberling, May 28 2013

Keywords

Comments

Let S be the set of numbers defined by these rules: 1 is in S, and if nonzero x is in S, then x + 1 and -1/x are in S. Then S is the set of all rational numbers, produced in generations as follows: g(1) = (1), g(2) = (2, -1), g(3) = (3, -1/2, 0), g(4) = (4, -1/3, 1/2), ... For n > 4, once g(n-1) = (c(1), ..., c(z)) is defined, g(n) is formed from the vector (c(1)+1, -1/c(1), c(2)+1, -1/c(2), ..., c(z)+1, -1/c(z)) by deleting previously generated elements. Let S' denote the sequence formed by concatenating the generations.
A226130: Denominators of terms of S'
A226131: Numerators of terms of S'
A226136: Positions of positive integers in S'
A226137: Positions of integers in S'

Examples

			S'= (1/1, 2/1, -1/1, 3/1, -1/2, 0/1, 4/1, -1/3, 1/2, ...), with integers appearing in positions 1,2,3,4,6,7,...
		

Crossrefs

Cf. A226080 (rabbit ordering of positive rationals).

Programs

  • Mathematica
    g[1] := {1}; z = 20; g[n_] := g[n] = DeleteCases[Flatten[Transpose[{# + 1, -1/#}]]&[DeleteCases[g[n - 1], 0]], Apply[Alternatives, Flatten[Map[g, Range[n - 1]]]]]; Flatten[Map[g, Range[7]]]  (* ordered rationals *)
    Map[g, Range[z]]; Table[Length[g[i]], {i, 1, z}] (* cf A003410 *)
    f = Flatten[Map[g, Range[z]]];
    Take[Denominator[f], 100] (* A226130 *)
    Take[Numerator[f], 100]   (* A226131 *)
    p1 = Flatten[Table[Position[f, n], {n, 1, z}]] (* A226136 *)
    p2 = Flatten[Table[Position[f, -n], {n, 0, z}]];
    Union[p1, p2]  (* A226137 *)  (* Peter J. C. Moses, May 26 2013 *)

A003411 Losing initial positions in game: two players alternate in removing >= 1 stones; last player wins; first player may not remove all stones; each move <= 3 times previous move.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 11, 15, 21, 29, 40, 55, 76, 105, 145, 200, 276, 381, 526, 726, 1002, 1383, 1909, 2635, 3637, 5020, 6929, 9564, 13201, 18221, 25150, 34714, 47915, 66136, 91286, 126000, 173915, 240051, 331337, 457337, 631252, 871303, 1202640, 1659977
Offset: 0

Views

Author

N. J. A. Sloane, R. K. Guy, Rodney W. Topor (rwt(AT)cit.gu.edu.au)

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Presumably equals A048590(n-3) - 3, n>3.

Programs

Formula

a(n) = a(n-1) + a(n-4), n >= 5.
G.f.: (1+x+x^2+x^3+x^4)/(1-x-x^4).

A171855 Triangle read by rows: T(n,k) is the number of binary words of length n that have no pair of adjacent 1's and have k subwords 0000 (n>=0; k=0 for n=0,1,2; 0<=k<=n-3 for n>=3).

Original entry on oeis.org

1, 2, 3, 5, 7, 1, 10, 2, 1, 15, 3, 2, 1, 22, 6, 3, 2, 1, 32, 11, 6, 3, 2, 1, 47, 18, 12, 6, 3, 2, 1, 69, 30, 20, 13, 6, 3, 2, 1, 101, 50, 34, 22, 14, 6, 3, 2, 1, 148, 81, 59, 38, 24, 15, 6, 3, 2, 1, 217, 130, 99, 68, 42, 26, 16, 6, 3, 2, 1, 318, 208, 163, 118, 77, 46, 28, 17, 6, 3, 2, 1, 466
Offset: 0

Views

Author

Emeric Deutsch, Feb 15 2010

Keywords

Comments

Row n has n-2 entries.
Sum of entries in row n is the Fibonacci number A000045(n+2).
T(n,0)=A003410(n). Sum(k*T(n,k),k>=0)=A004798(n-3) for n>=4.

Examples

			T(5,1)=2 because we have 00001 and 10000; T(7,2)=3 because we have 0000010, 0100000, and 1000001.
Triangle starts:
1;
2;
3;
5;
7,1;
10,2,1;
15,3,2,1;
22,6,3,2,1;
		

Crossrefs

Programs

  • Maple
    G := (1+z)*(1+z-t*z+z^2-t*z^2+z^3-t*z^3)/(1-t*z-z^2+t*z^3-z^3+t*z^4-z^4): Gser := simplify(series(G, z = 0, 18)): for n from 0 to 15 do P[n] := sort(coeff(Gser, z, n)) end do: 1; 2; 3; for n from 3 to 15 do seq(coeff(P[n], t, k), k = 0 .. n-3) end do; # yields sequence in triangular form

Formula

G.f.: G(t,z) = (1+z)(1+z-tz+z^2-tz^2+z^3-tz^3)/(1-tz-z^2+tz^3-z^3+tz^4-z^4).
Showing 1-10 of 14 results. Next