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-20 of 349 results. Next

A245377 Number of 2-alternating permutations of 1,2,...,n, that is, a(n) is the number of down/up permutations (A000111) of 1,2,...,n such that any two consecutive terms differ by at least two.

Original entry on oeis.org

1, 1, 0, 0, 1, 4, 17, 80, 422, 2480, 16095, 114432, 884969, 7398464, 66502048, 639653632, 6556170841, 71340409600, 821408397105, 9977630263296, 127518757153174, 1710576547456000, 24030971882538671, 352843606806499328
Offset: 0

Views

Author

Richard Stanley, Jul 19 2014

Keywords

Examples

			For n=5 there are the four permutations 31425, 31524, 52413, 42513.
		

Crossrefs

Cf. A002464.

Programs

  • Maple
    b:= proc(n, s, t) option remember; `if`(s={}, 1, add(
         `if`(t*(n-j)>=2, b(j, s minus{j}, -t), 0), j=s))
        end:
    a:= n->`if`(n=0, 1, add(b(j, {$1..j-1, $j+1..n}, 1), j=1..n)):
    seq(a(n), n=0..16);  # Alois P. Heinz, Oct 27 2014
  • Mathematica
    b[n_, s_, t_] := b[n, s, t] = If[s == {}, 1, Sum[If[t*(n - j) >= 2, b[j, s ~Complement~ {j}, -t], 0], {j, s}]]; a[n_] := a[n] = If[n == 0, 1, Sum[b[j, DeleteCases[Range[n], j], 1], {j, 1, n}]]; Table[Print[a[n]]; a[n], {n, 0, 16}] (* Jean-François Alcover, Oct 24 2016, after Alois P. Heinz *)

Extensions

a(11)-a(15) from R. J. Mathar, Oct 27 2014
a(16)-a(21) from Alois P. Heinz, Oct 27 2014
a(22) from Alois P. Heinz, Feb 18 2024
a(23) from Max Alekseyev, Feb 19 2024

A350970 Triangle T(n,k) (n>=0, 0<=k<=n) read by rows: T(0,0)=T(1,1)=1; T(n,0) is the Euler number A000111(n-1) for n>=1; T(n,n-1) = T(n,n) = (n-2)! for n>=2; interior entries are given by T(n,k) = m*T(n-1,k-1)+(k+1)*T(n-1,k+1) where m = k if n+k is even or k-1 if n+k is odd.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 5, 8, 6, 6, 5, 16, 28, 40, 24, 24, 16, 61, 136, 180, 240, 120, 120, 61, 272, 662, 1232, 1320, 1680, 720, 720, 272, 1385, 3968, 7266, 12096, 10920, 13440, 5040, 5040, 1385, 7936, 24568, 56320, 83664, 129024, 100800, 120960, 40320, 40320, 7936, 50521, 176896, 408360, 814080, 1023120, 1491840, 1028160, 1209600, 362880, 362880
Offset: 0

Views

Author

N. J. A. Sloane, Mar 03 2022

Keywords

Comments

Triangle connects Euler numbers on left and factorial numbers on right.

Examples

			Triangle begins:
    1,
    1,    1,
    1,    1,    1,
    1,    2,    2,    2,
    2,    5,    8,    6,     6,
    5,   16,   28,   40,    24,    24,
   16,   61,  136,  180,   240,   120,   120,
   61,  272,  662, 1232,  1320,  1680,   720,  720,
  272, 1385, 3968, 7266, 12096, 10920, 13440, 5040, 5040,
  ...
This may also be constructed as a square array, with entries T(n,k), n >= 1, 0 <= k, whose columns have e.g.f. equal to sec(x)+tan(x) (if k=0) and sec(x)*tan(x)^(k-1)*(sec(x)+tan(x)) (if k>0):
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
1, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
2, 5, 8, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, ...
5, 16, 28, 40, 24, 24, 0, 0, 0, 0, 0, 0, 0, ...
16, 61, 136, 180, 240, 120, 120, 0, 0, 0, 0, 0, 0, ...
61, 272, 662, 1232, 1320, 1680, 720, 720, 0, 0, 0, 0, 0, ...
272, 1385, 3968, 7266, 12096, 10920, 13440, 5040, 5040, 0, 0, 0, 0, ...
...
		

References

  • A. Boutin, Query 2784, L'Intermédiaire des Mathématiciens, 11 (1904), 252-254.
  • E. Estanave, Query 2784, L'Intermédiaire des Mathématiciens, 11 (1904), pp. 117-118.

Crossrefs

The initial columns are A000111, A000111, A225689, A350971.
The diagonals, reading from the right, are (essentially) A000142, A000142, A002301, A006157, A002302, A350973, A002303, A350974, A350975.
Rows sums give A156142(n-1).
Cf. A007836.

Programs

  • Maple
    for n from 0 to 12 do
    T[n]:=Array(0..n,0);
    T[0,0] := 1;
    T[1,0] := 1; T[1,1] := 1;
    if n>1 then
      T[n,0] := T[n-1,1];
    for k from 1 to n-2 do
    m:=k; if ((n+k) mod 2) = 0 then m:=k-1; fi;
    T[n,k] := m*T[n-1,k-1] + (k+1)*T[n-1,k+1];
    od:
    T[n,n-1] := (n-1)*T[n-1,n-2];
    T[n,n] := T[n,n-1];
    fi;
    lprint( [seq(T[n,k],k=0..n)] );
    od:
    # second Maple program:
    b:= proc(n, i) option remember; `if`(i=0,
         `if`(n=0, 1, 0), b(n, i-1)+b(n-1, n-i))
        end:
    T:= proc(n, k) option remember; `if`(n=0 and k=0, 1,
         `if`(k=0, b(n-1$2), `if`(n-k<=1, (n-1)!, (k+1)*
          T(n-1, k+1)+(k-irem(1+n+k, 2))*T(n-1, k-1))))
        end:
    seq(seq(T(n, k), k=0..n), n=0..10);  # Alois P. Heinz, Mar 04 2022
    # To produce the square array, N. J. A. Sloane, Mar 05 2022:
    read(transforms):
    myegf := (f,M) -> SERIESTOLISTMULT(series(f,x,M));
    T:=proc(n,k,M) local i;
    if k=0 then myegf((sec(x)+tan(x)),M)[n];
    else
    myegf(sec(x)*tan(x)^(k-1)*(sec(x)+tan(x)),M)[n];
    fi;
    end;
    [seq(T(n,0,16),n=1..5)];
    for n from 1 to 8 do
    lprint([seq(T(n,k,16),k=0..12)]);
    od:
  • Mathematica
    b[n_, i_] := b[n, i] = If[i == 0,
         If[n == 0, 1, 0], b[n, i - 1] + b[n - 1, n - i]];
    T[n_, k_] := T[n, k] = If[n == 0 && k == 0, 1,
         If[k == 0, b[n - 1, n - 1], If[n - k <= 1, (n - 1)!, (k + 1)*
         T[n - 1, k + 1] + (k - Mod[1 + n + k, 2])*T[n - 1, k - 1]]]];
    Table[Table[T[n, k], {k, 0, n}], {n, 0, 10}] // Flatten (* Jean-François Alcover, Mar 12 2022, Alois P. Heinz *)

Formula

If we ignore the n=0 row, then the e.g.f. for column 0 is sec(x)+tan(x), and for column k >= 1 it is sec(x)*tan(x)^(k-1)*(sec(x)+tan(x)). See the initial rows of the square array in the EXAMPLES section. - N. J. A. Sloane, Mar 05 2022
abs(Sum_{k=0..n} (-1)^k * T(n,k)) = A007836(n) for n>=2. - Alois P. Heinz, Mar 04 2022

A260786 Twice the Euler or up/down numbers A000111.

Original entry on oeis.org

2, 2, 2, 4, 10, 32, 122, 544, 2770, 15872, 101042, 707584, 5405530, 44736512, 398721962, 3807514624, 38783024290, 419730685952, 4809759350882, 58177770225664, 740742376475050, 9902996106248192, 138697748786275802, 2030847773013704704, 31029068327114173810, 493842960380415967232
Offset: 0

Views

Author

N. J. A. Sloane, Aug 04 2015

Keywords

Crossrefs

Cf. A000111.
Apart from initial terms, same as A001250.

Programs

  • Maple
    f:=proc(n) option remember;
    if n <= 1 then 2 else (1/4)*add(binomial(n-1,k-1)*f(k-1)*f(n-k),k=1..n); fi;
    end;
    [seq(f(n),n=0..30)];
  • Python
    from itertools import accumulate, islice
    def A260786_gen(): # generator of terms
        yield from (2,2)
        blist = (0,2)
        while True:
            yield (blist := tuple(accumulate(reversed(blist),initial=0)))[-1]
    A260786_list = list(islice(A260786_gen(),30)) # Chai Wah Wu, Apr 17 2023

Formula

a(0)=a(1)=2; thereafter a(n) = (1/4)*Sum_{k=1..n} binomial(n-1, k-1)*a(k-1)*a(n-k).

A141430 a(n) = A000111(n) mod 9.

Original entry on oeis.org

1, 1, 1, 2, 5, 7, 7, 2, 8, 7, 4, 2, 2, 7, 1, 2, 5, 7, 7, 2, 8, 7, 4, 2, 2, 7, 1, 2, 5, 7, 7, 2, 8, 7, 4, 2, 2, 7, 1, 2, 5, 7, 7, 2, 8, 7, 4, 2, 2, 7
Offset: 0

Views

Author

Paul Curtz, Aug 06 2008

Keywords

Comments

After the initial 1,1, the sequence is periodic with period 12.
This sequence's periodic part is a shuffled version of the two period-6 sequences A070366 and A010697. The sequence contains only the digits 1, 2, 4, 5, 7 and 8 (those of A141425).

Crossrefs

Programs

  • Python
    def A141430(n): return (2, 7, 1, 2, 5, 7, 7, 2, 8, 7, 4, 2)[n%12] if n>1 else 1 # Chai Wah Wu, Apr 17 2023

Formula

a(n) = A000111(n) mod 9 = A004099(n) mod 9.
a(n+12) = a(n), n > 1.
a(n) + a(n+6) = 9, n > 1.
a(n+11-p) - a(n+p) = 6 (p=0 or 5), 0 (p=1 or 4), -3 (p=2 or 3), any n > 1.
G.f.: (6x^8-5x^7+x^6+2x^5+3x^4+x^3+1) / ((1-x)(x^2+1)(x^4-x^2+1)). - R. J. Mathar, Dec 05 2008
a(n) = 9/2 +(-1)^floor(n/2)*A010686(n)/2 - 3*A014021(n), n > 1. - R. J. Mathar, Dec 05 2008
a(n) = 9/2 - (3/2)*cos(Pi*n/6) + (1/2)*3^(1/2)*sin(Pi*n/6) - (1/2)*cos(Pi*n/2) - (5/2)*sin(Pi*n/2) - (3/2)*cos(5*Pi*n/6) - (1/2)*3^(1/2)*sin(5*Pi*n/6). - Richard Choulet, Dec 12 2008

Extensions

Edited by R. J. Mathar, Dec 05 2008

A180418 a(n) = ( A000111(p) -(-1)^((p-1)/2) )/p, where p = prime(n).

Original entry on oeis.org

1, 3, 39, 32163, 1720635, 12345020175, 1530993953307, 44148864630732711, 797213247855503373843915, 281095572810489332134542303, 26242778669866462496740532647355475
Offset: 2

Views

Author

Vladimir Shevelev, Sep 03 2010

Keywords

Crossrefs

Programs

  • Mathematica
    t = Range[0, 60]! CoefficientList[Series[Sec@x + Tan@x, {x, 0, 60}], x]; f[n_] := (Rest[t][[Prime@n]] - (-1)^((Prime@n - 1)/2))/Prime@n; Array[f, 11, 2] (* Robert G. Wilson v, Sep 04 2010 *)

Formula

a(n) = ( A000111(A000040(n)) -A070750(n) )/A000040(n). - R. J. Mathar, Sep 19 2010

Extensions

Extended by R. J. Mathar, Sep 19 2010
a(8) onwards from Robert G. Wilson v, Sep 04 2010

A373433 a(n) = A000111(n) * A000142(n). Row sums of A373434.

Original entry on oeis.org

1, 1, 2, 12, 120, 1920, 43920, 1370880, 55843200, 2879815680, 183330604800, 14122244505600, 1294628759424000, 139287595371724800, 17379949655535667200, 2489494639794978816000, 405724534220435189760000, 74646464089618378653696000, 15396938399483145082626048000
Offset: 0

Views

Author

Peter Luschny, Jun 04 2024

Keywords

Crossrefs

Programs

  • Maple
    A373433 := n -> ifelse(n = 0, 1, n! * 2^n * abs(euler(n, 1/2) + euler(n, 1))):
    seq(A373433(n), n = 0..18);
  • Mathematica
    A373433[n_] := 2 I^(n + 1) n! PolyLog[-n, -I]; A373433[0] := 1;
    Table[A373433[n], {n, 0, 18}]
  • SageMath
    # Algorithm of Ludwig Seidel (1877).
    def A373433_list(n) :
        R = []; S = []; A = {-1:0, 0:1}; k = 0; f = 1; e = 1
        for i in (0..n) :
            Am = 0; A[k + e] = 0; e = -e
            for j in (0..i) : Am += A[k]; A[k] = Am; k += e
            R.append(Am); S.append(f*Am); f *= i + 1
        return S
    print(A373433_list(18))

Formula

a(n) = n! * 2^n * |Euler(n, 1/2) + Euler(n, 1)| for n >= 1.
a(n) ~ ((2*n^2)/(Pi*e^2))^n*(8*n + 4/3).

A141479 a(n) = A000111(n) + A014695(n).

Original entry on oeis.org

2, 3, 3, 3, 6, 18, 63, 273, 1386, 7938, 50523, 353793, 2702766, 22368258, 199360983, 1903757313, 19391512146, 209865342978, 2404879675443, 29088885112833, 370371188237526, 4951498053124098, 69348874393137903, 1015423886506852353
Offset: 0

Views

Author

Paul Curtz, Aug 09 2008

Keywords

Comments

a(n) is a multiple of 3 for n > 0.

Programs

  • Maple
    A000111 := proc(n) local x; n!*coeftayl( sec(x)+tan(x),x=0,n) ; end: A014695 := proc(n) local x; coeftayl( (1+2*x+2*x^2+x^3)/(1-x^4),x=0,n) ; end: A141479 := proc(n) A000111(n)+A014695(n) ; end: for n from 0 to 30 do printf("%a,",A141479(n)) ; od; # R. J. Mathar, Sep 12 2008
  • Python
    from itertools import count, islice, accumulate
    def A141479_gen(): # generator of terms
        yield from (2,3)
        blist = (0,1)
        for n in count(0):
            yield (blist := tuple(accumulate(reversed(blist),initial=0)))[-1] + (2,1,1,2)[n & 3]
    A141479_list = list(islice(A141479_gen(),40)) # Chai Wah Wu, Jun 09-11 2022

Extensions

Extended by R. J. Mathar, Sep 12 2008

A173253 Partial sums of A000111.

Original entry on oeis.org

1, 2, 3, 5, 10, 26, 87, 359, 1744, 9680, 60201, 413993, 3116758, 25485014, 224845995, 2128603307, 21520115452, 231385458428, 2636265133869, 31725150246701, 402096338484226, 5353594391608322, 74702468784746223, 1090126355291598575, 16604660518848685480
Offset: 0

Views

Author

Jonathan Vos Post, Feb 14 2010

Keywords

Comments

Partial sums of Euler or up/down numbers. Partial sums of expansion of sec x + tan x. Partial sums of number of alternating permutations on n letters.

Examples

			a(22) = 1 + 1 + 1 + 2 + 5 + 16 + 61 + 272 + 1385 + 7936 + 50521 + 353792 + 2702765 + 22368256 + 199360981 + 1903757312 + 19391512145 + 209865342976 + 2404879675441 + 29088885112832 + 370371188237525 + 4951498053124096 + 69348874393137901.
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o) option remember;
          `if`(u+o=0, 1, add(b(o-1+j, u-j), j=1..u))
        end:
    a:= proc(n) option remember;
          `if`(n<0, 0, a(n-1))+ b(n, 0)
        end:
    seq(a(n), n=0..25);  # Alois P. Heinz, Oct 27 2017
  • Mathematica
    With[{nn=30},Accumulate[CoefficientList[Series[Sec[x]+Tan[x],{x,0,nn}],x] Range[0,nn]!]] (* Harvey P. Dale, Feb 26 2012 *)
  • Python
    from itertools import accumulate
    def A173253(n):
        if n<=1:
            return n+1
        c, blist = 2, (0,1)
        for _ in range(n-1):
            c += (blist := tuple(accumulate(reversed(blist),initial=0)))[-1]
        return c # Chai Wah Wu, Apr 16 2023

Formula

a(n) = SUM[i=0..n] A000111(i) = SUM[i=0..n] (2^i|E(i,1/2)+E(i,1)| where E(n,x) are the Euler polynomials).
G.f.: (1 + x/Q(0))/(1-x),m=+4,u=x/2, where Q(k) = 1 - 2*u*(2*k+1) - m*u^2*(k+1)*(2*k+1)/( 1 - 2*u*(2*k+2) - m*u^2*(k+1)*(2*k+3)/Q(k+1) ) ; (continued fraction). - Sergei N. Gladkovskii, Sep 24 2013
G.f.: 1/(1-x) + T(0)*x/(1-x)^2, where T(k) = 1 - x^2*(k+1)*(k+2)/(x^2*(k+1)*(k+2) - 2*(1-x*(k+1))*(1-x*(k+2))/T(k+1) ); (continued fraction). - Sergei N. Gladkovskii, Nov 20 2013
a(n) ~ 2^(n+2)*n!/Pi^(n+1). - Vaclav Kotesovec, Oct 27 2016

A180417 a(n) = (A000111(2^n) - 1) / 2^n.

Original entry on oeis.org

0, 0, 1, 173, 1211969509, 5547480986860602794895774677, 708720364531529518355420122993246286974247836241724513772950684967495246261
Offset: 0

Views

Author

Vladimir Shevelev, Sep 03 2010

Keywords

Comments

The definition yields integers according to the formula in A000111.
The next term a(7) is too large to include. - N. J. A. Sloane, Mar 14 2011

Crossrefs

Programs

  • Mathematica
    t = Range[0, 65]! CoefficientList[ Series[ Sec@x + Tan@x, {x, 0, 65}], x]; f[n_] := (Rest[t][[2^n]] - 1)/2^n; Array[f, 7, 0] (* Robert G. Wilson v, Sep 04 2010 *)
  • Python
    from sympy import euler
    def A180417(n): return euler(1<>n if n > 1 else 0 # Chai Wah Wu, Apr 18 2023

Extensions

Two more terms from R. J. Mathar, Sep 19 2010
a(5) and a(6) from Robert G. Wilson v, Sep 04 2010

A180942 Odd composite numbers m for which A000111(m) == (-1)^( (m-1)/2 ) (mod m).

Original entry on oeis.org

91, 561, 781, 1105, 1661, 1729, 2465, 2737, 2821, 6601, 8911, 10585, 15841, 29341, 30433, 41041, 46657, 52633, 62745, 63973, 75361, 90241, 101101, 115921, 126217, 136371, 136741, 137149, 162401, 172081, 176565, 188461, 251251, 252601, 278545, 294409, 314821, 334153
Offset: 1

Views

Author

Vladimir Shevelev, Sep 27 2010

Keywords

Comments

For any odd prime p, A000111(p) == (-1)^((p-1)/2) mod p, see A180418, so these cases are not considered further and left out of the sequence by definition.
Might be called "Zig-zag pseudoprimes."
It seems that every Carmichael number (A002997) <= 512461 is in the sequence. - D. S. McNeil, Sep 01 2010

Crossrefs

Cf. A000111.

Programs

  • Mathematica
    fQ[n_] := ! PrimeQ@n && Mod[ (-1)^((n - 1)/2)*2^(n + 1)*(2^(n + 1) - 1)*BernoulliB[n + 1]/(n + 1), n] == Mod[(-1)^((n - 1)/2), n]; k = 3; lst = {}; While[k < 50000, If[ fQ@k, AppendTo[lst, k]; Print@k]; k += 2]; lst (* Robert G. Wilson v, Sep 29 2010 *)
  • Python
    from itertools import count, islice, accumulate
    from sympy import isprime
    def A180942_gen(): # generator of terms
        blist = (0,1)
        for n in count(2):
            blist = tuple(accumulate(reversed(blist),initial=0))
            if n & 1 and (blist[-1] + (1 if (n-1)//2 & 1 else -1)) % n == 0 and not isprime(n):
                yield n
    A180942_list = list(islice(A180942_gen(),5)) # Chai Wah Wu, Jun 09-11 2022

Extensions

Extended to a(13) by D. S. McNeil, Sep 01 2010
Comments rephrased by R. J. Mathar, Sep 29 2010
a(14)-a(17) from Robert G. Wilson v, Sep 29 2010
a(18)-a(38) from Amiram Eldar, Dec 28 2019
Previous Showing 11-20 of 349 results. Next