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

A167556 A triangle related to the GF(z) formulas of the rows of the ED1 array A167546.

Original entry on oeis.org

1, 1, 2, 2, 6, 2, 6, 24, 4, 8, 24, 120, 0, 48, 24, 120, 720, -120, 384, 72, 144, 720, 5040, -1680, 3696, -432, 1296, 720, 5040, 40320, -20160, 40320, -15840, 17280, 2880, 5760, 40320, 362880, -241920, 483840, -311040, 288000, -46080, 69120, 40320
Offset: 1

Views

Author

Johannes W. Meijer, Nov 10 2009

Keywords

Comments

The GF(z) formulas given below correspond to the first ten rows of the ED1 array A167546. The polynomials in their numerators lead to the triangle given above.

Examples

			Row 1: GF(z) = 1/(1-z).
Row 2: GF(z) = (1 + 2*z)/(1-z)^2.
Row 3: GF(z) = (2 + 6*z + 2*z^2)/(1-z)^3.
Row 4: GF(z) = (6 + 24*z + 4*z^2 + 8*z^3)/(1-z)^4.
Row 5: GF(z) = (24 + 120*z + 0*z^2 + 48*z^3 + 24*z^4)/(1-z)^5.
Row 6: GF(z) = (120 + 720*z - 120*z^2 + 384*z^3 + 72*z^4 + 144*z^5)/ (1-z)^6.
Row 7: GF(z) = (720 + 5040*z - 1680*z^2 + 3696*z^3 - 432*z^4 + 1296*z^5 + 720*z^6)/(1-z)^7.
Row 8: GF(z) = (5040 + 40320*z - 20160*z^2 + 40320*z^3 - 15840*z^4 + 17280*z^5 + 2880*z^6 + 5760*z^7)/(1-z)^8.
Row 9: GF(z) = (40320 +362880*z -241920*z^2 + 483840*z^3 - 311040*z^4 + 288000*z^5 - 46080*z^6 + 69120*z^7 + 40320*z^8)/(1-z)^9.
Row 10: GF(z) = (362880 +3628800*z -3024000*z^2 +6289920*z^3 -5495040*z^4 + 5276160*z^5 - 2131200*z^6 + 1382400*z^7 + 201600*z^8 + 403200*z^9)/(1-z)^10;
		

Crossrefs

A167546 is the ED1 array.
A000142, A000142 (n=>2) and 120*A062148 (with three extra terms at the beginning of the sequence) equal the first three left hand triangle columns.
A098557(n) and A098557(n)*A064455(n) equal the first two right hand triangle columns.
A007680 equals the row sums.

A225144 a(n) = Sum_{i=n..2*n} i^2*(-1)^i.

Original entry on oeis.org

0, 3, 11, 18, 42, 45, 93, 84, 164, 135, 255, 198, 366, 273, 497, 360, 648, 459, 819, 570, 1010, 693, 1221, 828, 1452, 975, 1703, 1134, 1974, 1305, 2265, 1488, 2576, 1683, 2907, 1890, 3258, 2109, 3629, 2340, 4020, 2583, 4431, 2838, 4862, 3105, 5313, 3384
Offset: 0

Views

Author

Bruno Berselli, Jun 06 2013

Keywords

Comments

3 and 11 are the only primes in the sequence.

Examples

			a(6) = 6^2-7^2+8^2-9^2+10^2-11^2+12^2 = 93.
a(7) = -7^2+8^2-9^2+10^2-11^2+12^2-13^2+14^2 = 84.
		

Crossrefs

Cf. A050409: sum(i^2, i=n..2n); A064455: sum(i*(-1)^i, i=n..2n); A065679: A000217(n)+(-1)^n*A000217(n-1); A089594: sum(i^2*(-1)^i, i=1..n).

Programs

  • Magma
    [&+[i^2*(-1)^i: i in [n..2*n]]: n in [0..50]];
  • Mathematica
    Table[Sum[i^2 (-1)^i, {i, n, 2 n}], {n, 0, 50}]

Formula

G.f.: x*(3+11*x+9*x^2+9*x^3)/(1-x^2)^3.
a(n) = 3*a(n-2)-3*a(n-4)+a(n-6).
a(n) = n*(4*n+(n-1)*(-1)^n+2)/2.
a(n) = A000217(2n) +(-1)^n*A000217(n-1) with A000217(-1)=0.
a(2n-1) = A094159(n) for n>0; a(2n) = A055437(n) for A055437(0)=0.

A265888 a(n) = n + floor(n/4)*(-1)^(n mod 4).

Original entry on oeis.org

0, 1, 2, 3, 5, 4, 7, 6, 10, 7, 12, 9, 15, 10, 17, 12, 20, 13, 22, 15, 25, 16, 27, 18, 30, 19, 32, 21, 35, 22, 37, 24, 40, 25, 42, 27, 45, 28, 47, 30, 50, 31, 52, 33, 55, 34, 57, 36, 60, 37, 62, 39, 65, 40, 67, 42, 70, 43, 72, 45, 75, 46, 77, 48, 80, 49, 82, 51, 85, 52, 87
Offset: 0

Views

Author

Bruno Berselli, Dec 18 2015

Keywords

Comments

This sequence does not include the numbers of the type 3*A047202(n)+2.
a(n) = n + floor(n/4)*(-1)^(n mod 2). - Chai Wah Wu, Jan 29 2023

Crossrefs

Cf. A064455: n+floor(n/2)*(-1)^(n mod 2).
Cf. A265667: n+floor(n/3)*(-1)^(n mod 3).
Cf. A265734: n+floor(n/5)*(-1)^(n mod 5).

Programs

  • Magma
    [n+Floor(n/4)*(-1)^(n mod 4): n in [0..70]];
    
  • Mathematica
    Table[n + Floor[n/4] (-1)^Mod[n, 4], {n, 0, 70}]
    LinearRecurrence[{0, 1, 0, 1, 0, -1}, {0, 1, 2, 3, 5, 4}, 80]
  • PARI
    x='x+O('x^100); concat(0, Vec(x*(1+2*x+2*x^2+3*x^3)/((1+x^2)*(1- x^2)^2))) \\ Altug Alkan, Dec 22 2015
    
  • Python
    def A265888(n): return n+(-(n>>2) if n&1 else n>>2) # Chai Wah Wu, Jan 29 2023
  • Sage
    [n+floor(n/4)*(-1)^mod(n, 4) for n in (0..70)]
    

Formula

G.f.: x*(1 + 2*x + 2*x^2 + 3*x^3)/((1 + x^2)*(1 - x^2)^2).
a(n) = a(n-2) + a(n-4) - a(n-6) for n>5.
a(n+1) + a(n) = A047624(n+1).
a(4*k+r) = (4+(-1)^r)*k + r mod 3, where r = 0..3.

A071045 Number of 0's in n-th row of triangle in A071030.

Original entry on oeis.org

0, 0, 3, 1, 6, 2, 9, 3, 12, 4, 15, 5, 18, 6, 21, 7, 24, 8, 27, 9, 30, 10, 33, 11, 36, 12, 39, 13, 42, 14, 45, 15, 48, 16, 51, 17, 54, 18, 57, 19, 60, 20, 63, 21, 66, 22, 69, 23, 72, 24, 75, 25, 78, 26, 81, 27, 84, 28, 87, 29, 90, 30, 93, 31, 96, 32, 99, 33, 102, 34
Offset: 0

Views

Author

Hans Havermann, May 26 2002

Keywords

References

  • Stephen Wolfram, A New Kind of Science, Wolfram Media, 2002; Chapter 3.

Crossrefs

Programs

  • Maple
    a := n -> n + ((-1)^n*(2*n + 1) - 1)/4;
    seq(a(n), n=0..69); # Peter Luschny, Feb 11 2019
  • Mathematica
    LinearRecurrence[{0, 2, 0, -1}, {0, 0, 3, 1}, 70] (* Jean-François Alcover, Jul 08 2019 *)

Formula

a(n) = Sum_{k=0..n-1} Sum_{i=0..k} C(i,k) - (-1)^k. - Wesley Ivan Hurt, Sep 20 2017
a(n) = n + ((-1)^n*(2*n + 1) - 1)/4 = n - A001057(n). - Peter Luschny, Feb 11 2019
For n > 0: a(n) = (n^2 - 1) mod (2*n + 1). - Ctibor O. Zizka, Mar 11 2025

A377137 Array read by rows (blocks). Each row is a permutation of a block of consecutive numbers; the blocks are disjoint and every positive number belongs to some block. Row n contains 3n/2 elements if n is even, and (n+1)/2 elements if n is odd; ; see Comments.

Original entry on oeis.org

1, 4, 2, 3, 6, 5, 12, 10, 8, 7, 9, 11, 15, 13, 14, 24, 22, 20, 18, 16, 17, 19, 21, 23, 28, 26, 25, 27, 40, 38, 36, 34, 32, 30, 29, 31, 33, 35, 37, 39, 45, 43, 41, 42, 44, 60, 58, 56, 54, 52, 50, 48, 46, 47, 49, 51, 53, 55, 57, 59, 66, 64, 62, 61, 63, 65, 84, 82, 80, 78, 76, 74, 72, 70, 68, 67, 69, 71, 73, 75, 77, 79, 81, 83, 91, 89, 87, 85, 86
Offset: 1

Views

Author

Boris Putievskiy, Oct 17 2024

Keywords

Comments

Row n has length A064455(n). The sequence A064455 is non-monotonic.
The array consists of two triangular arrays alternating row by row.
For odd n, row n consists of permutations of the integers from A001844((n-1)/2) to A265225(n-1). For even n, row n consists of permutations of the integers from A130883(n/2) to A265225(n-1).
These permutations are generated by the algorithm described A130517.
The sequence is an intra-block permutation of the positive integers.

Examples

			Array begins:
     k =  1   2   3   4   5   6
  n=1:    1;
  n=2:    4,  2,  3;
  n=3:    6,  5;
  n=4:   12, 10,  8,  7,  9, 11;
The triangular arrays alternate by row: n=1 and n=3 comprise one, and n=2 and n=4 comprise the other.
Subtracting (n^2 - 1)/2 if n is odd from each term in row n produces a permutation of 1 .. (n+1)/2. Subtracting (n^2 - n)/2 if n is even from each term in row n produces a permutation of 1 .. 3n/2:
  1,
  3, 1, 2,
  2, 1,
  6, 4, 2, 1, 3, 5,
  ...
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Module[{L,R, P,Result},L=Ceiling[Max[x/.NSolve[x*(2*(x-1)-Cos[Pi*(x-1)]+5)-4*n==0,x,Reals]]]; R=n-If[EvenQ[L],(L^2-L)/2,(L^2-1)/2]; P[(L+1)*(2*L-(-1)^L+5)/4]=If[EvenQ[L],3L/2,(L+1)/2]; P[3]=2; P= Abs[2*R-If[EvenQ[L],3L/2,(L+1)/2]-If[2*R<=If[EvenQ[L],3L/2,(L+1)/2]+1,2,1]]; Res=P+If[EvenQ[L],(L^2-L)/2,(L^2-1)/2]; Result=Res; Result] Nmax= 12; Table[a[n],{n,1,Nmax}]

Formula

Linear sequence:
a(n) = P(n) + B(L(n)-1), where L(n) = ceiling(x(n)), x(n) is largest real root of the equation B(x) - n = 0. B(n) = (n+1)*(2*n-(-1)^n+5)/4 = A265225(n). P(n) = A162630(n)/2.
Array T(n,k) (see Example):
T(n, k) = P(n, k) + (n^2 - n)/2 if n is even, T(n, k) = P(n, k) + (n^2 - 1)/2 if n is odd, T(n, k) = P(n, k) + A265225(n-1). P(n, k) = |2k - 3n / 2 - 2| if n is even and if 2k <= 3n / 2 + 1, P(n, k) = |2k - 3n / 2 - 1| if n is even and if 2k > 3n / 2 + 1. P(n, k) = |2k - (n + 1) / 2 - 2| if n is odd and if 2k <= (n + 1) / 2 + 1, P(n, k) = |2k - (n + 1) / 2 - 1| if n is odd and if 2k > (n + 1) / 2 + 1. There are several special cases: P(n, 1) = 3n/2 if n is even, P(n, 1) = (n+1)/2 if n is odd. P(2, 2) = 1. P(n, n) = n/2 - 1 if n is even, P(n, n) = (n-3)/2 if n is odd.

A378127 Inverse permutation to A377137.

Original entry on oeis.org

1, 3, 4, 2, 6, 5, 10, 9, 11, 8, 12, 7, 14, 15, 13, 20, 21, 19, 22, 18, 23, 17, 24, 16, 27, 26, 28, 25, 35, 34, 36, 33, 37, 32, 38, 31, 39, 30, 40, 29, 43, 44, 42, 45, 41, 53, 54, 52, 55, 51, 56, 50, 57, 49, 58, 48, 59, 47, 60, 46, 64, 63, 65, 62, 66, 61, 76, 75, 77, 74, 78, 73, 79, 72, 80, 71, 81, 70, 82, 69, 83, 68, 84, 67, 88, 89, 87, 90, 86, 91
Offset: 1

Views

Author

Boris Putievskiy, Nov 17 2024

Keywords

Comments

Array read by rows (blocks). Each row is a permutation of a block of consecutive numbers; the blocks are disjoint and every positive number belongs to some block.
Row n has length A064455(n). The sequence A064455 is non-monotonic.
Subtracting (n^2 - n)/2 if n is even from each term in row n produces a permutation of 1 .. 3n/2. Subtracting (n^2 - 1)/2 if n is odd from each term in row n produces a permutation of 1 .. (n+1)/2.
These permutations are inverses of the corresponding permutations from A377137. The algorithm used to generate them is described in A209278.
The sequence is an intra-block permutation of the positive integers.

Examples

			Array begins:
     k =  1   2   3   4   5   6
  n=1:    1;
  n=2:    3,  4,  2;
  n=3:    6,  5;
  n=4:   10,  9, 11,  8, 12, 7;
 The triangular arrays alternate by row: n=1 and n=3 comprise one, and n=2 and n=4 comprise the other. Subtracting 1, 4, and 6 from the elements of rows 2, 3, and 4, respectively, produces permutations:
  1;
  2, 3, 1;
  2, 1;
  4, 3, 5, 2, 6, 1;
  ...
These permutations are the inverses of those in Example A377137, listed in the same order.
(2,3,1)^(-1) = (3,1,2); (2,1)^(-1) = (2,1); (4,3,5,2,6,1)^(-1) = (6,4,2,1,3,5).
		

Crossrefs

Programs

  • Mathematica
    b[n_]:=(4n+1+(2n-1)*(-1)^n)/4;P[n_,k_]:=If[EvenQ[b[n]-k],(b[n]-k+2)/2,(b[n]+k+1)/2];Res[n_,k_]:=P[n,k]+(-(-1)^n*n+(-1)^n+2 n^2-n-1)/4;
    Nmax=4;resultTable=Table[Res[n,k],{n,1,Nmax},{k,1,b[n]}]//Flatten

Formula

Array T(n,k) (see Example):
T(n, k) = P(n, k) + A265225(n-1), where
P(n, k) = (b(n) - k + 2)/2 if mod(b(n) - k, 2) = 0,
P(n, k) = (b(n) + k + 1)/2 if mod(b(n) - k, 2) = 1.
b(n) = (4n + 1 + (2n - 1) * (-1)^n)/4 is the length of the row n.

A378626 Table T(n, k) read by upward antidiagonals. T(n,1) = A377137(n), T(n,2) = A377137(A377137(n)), T(n,3) = A377137(A377137(A377137(n))) and so on.

Original entry on oeis.org

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

Views

Author

Boris Putievskiy, Dec 02 2024

Keywords

Comments

The sequence A377137 generates infinite cyclic group under composition. The identity element is A000027.
Each column is array read by rows. Each row is a permutation of a block of consecutive numbers; the blocks are disjoint and every positive number belongs to some block.
Row n has length A064455(n). The sequence A064455 is non-monotonic.
The array consists of two triangular arrays alternating row by row.
For odd n, row n consists of permutations of the integers from A001844((n-1)/2) to A265225(n-1). For even n, row n consists of permutations of the integers from A130883(n/2) to A265225(n-1).
Each column is an intra-block permutation of the positive integers.

Examples

			Table begins:
  k =      1   2   3   4   5   6
--------------------------------------
  n =  1:  1,  1,  1,  1,  1,  1, ...
  n =  2:  4,  3,  2,  4,  3,  2, ...
  n =  3:  2,  4,  3,  2,  4,  3, ...
  n =  4:  3,  2,  4,  3,  2,  4, ...
  n =  5:  6,  5,  6,  5,  6,  5, ...
  n =  6:  5,  6,  5,  6,  5,  6, ...
  n =  7: 12, 11,  9,  8, 10,  7, ...
  n =  8: 10,  7, 12, 11,  9,  8, ...
  n =  9:  8, 10,  7, 12, 11,  9, ...
  n = 10:  7, 12, 11,  9,  8, 10, ...
  n = 11:  9,  8, 10,  7, 12, 11, ...
  n = 12: 11,  9,  8, 10,  7, 12, ...
  n = 13: 15, 14, 13, 15, 14, 13, ...
  n = 14: 13, 15, 14, 13, 15, 14, ...
  n = 15: 14, 13, 15, 14, 13, 15, ...
Column k = 1 contains the start of A377137. Ord(T(1,1),T(2,1), ... T(15,1)) = 6, ord(T(1,1),T(2,1), ... T(24,1)) = 18, ord(T(1,1),T(2,1), ... T(45,1)) = 90, ord(T(1,1),T(2,1), ... T(112,1)) = 1260, where ord is order of permutation.
The first 6 antidiagonals are:
  1;
  4, 1;
  2, 3, 1;
  3, 4, 2, 1;
  6, 2, 3, 4, 1;
  5, 5, 4, 2, 3, 1;
		

Crossrefs

Cf. A000027, A064455 (row lengths), A265225, A377137, A378127.

Programs

  • Mathematica
    a[n_]:=Module[{L,R,P,Result},L=Ceiling[Max[x/.NSolve[x*(2*(x-1)-Cos[Pi*(x-1)]+5)-4*n==0,x,Reals]]];R=n-If[EvenQ[L],(L^2-L)/2,(L^2-1)/2]; P[(L+1)*(2*L-(-1)^L+5)/4]=If[EvenQ[L],3L/2,(L+1)/2];P[3]=2;P=Abs[2*R-If[EvenQ[L],3L/2,(L+1)/2]-If[2*R<=If[EvenQ[L],3L/2,(L+1)/2]+1,2,1]];Res=P+If[EvenQ[L],(L^2-L)/2,(L^2-1)/2];Result=Res;Result] (*A377137*)
    composeSequence[a_,n_,k_]:=Nest[a,n,k]
    Nmax=15;Kmax=6;T=Table[composeSequence[a,n,k],{n,1,Nmax},{k,1,Kmax}]

Formula

(T(1,k),T(2,k), ... T(A265225(n),k)) is permutation of the integers from 1 to A265225(n). (T(1,k),T(2,k), ... T(A265225(n),k)) = (T(1,1),T(2,1), ... T(A265225(n),1))^k.

A119789 T(n, k) = floor(log_{goldenratio}(Fibonacci(n)*Fibonacci(k))), with T(n, k) = 0 for n < 3, T(n, 0) = n-2 for n > 2, triangle read by rows.

Original entry on oeis.org

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

Views

Author

Roger L. Bagula, Jul 30 2006

Keywords

Examples

			Triangle begins as:
  0;
  0, 0;
  0, 0, 0;
  1, 1, 1, 2;
  2, 2, 2, 3, 4;
  3, 3, 3, 4, 5, 6;
  4, 4, 4, 5, 6, 7, 8;
  5, 5, 5, 6, 7, 8, 9, 10;
		

Crossrefs

Programs

  • Magma
    A119789:= func< n,k | n le 2 select 0 else k le 1 select n-2 else n+k-4 >;
    [A119789(n,k): k in [0..n], n in [0..12]]; // G. C. Greubel, Dec 17 2022
    
  • Mathematica
    f[n_, k_]= If[n<3, 0, If[k==0, n-2, Floor[Log[GoldenRatio, Fibonacci[n]*Fibonacci[k]]]]];
    Table[f[n, k], {n,0,12}, {k,0,n}]//Flatten
    (* Second program *)
    T[n_, k_]:= T[n, k]= If[n<3, 0, If[k<2, n-2, n+k-4]];
    Table[T[n, k], {n,0,12}, {k,0,n}]//Flatten (* G. C. Greubel, Dec 17 2022 *)
  • SageMath
    def A119789(n,k):
        if (n<3): return 0
        elif (k<2): return n-2
        else: return n+k-4
    flatten([[A119789(n,k) for k in range(n+1)] for n in range(13)]) # G. C. Greubel, Dec 17 2022

Formula

T(n, k) = floor(log_{goldenratio}(Fibonacci(n)*Fibonacci(k))), with T(n, k) = 0 for n < 3, T(n, 0) = n-2 for n > 2.
From G. C. Greubel, Dec 17 2022: (Start)
T(n, k) = n+k-4, with T(n, k) = 0 for n < 3, T(n, 0) = n-2 for n >= 3.
T(n, n) = 2*T(n, 0).
T(2*n, n) = 0*[n<2] + A016789(n-2)*[n>1].
T(2*n, n+1) = 3*A001477(n-1), for n > 0.
T(2*n, n-1) = A033627(n) - [n=1].
T(3*n, n) = n*[n<2] + 4*A000027(n-2)*[n>1].
Sum_{k=0..n} T(n, k) = 0*[n<2] + A140090(n-2)*[n>1].
Sum_{k=0..n} (-1)^k * T(n, k) = 0*[n<2] + (-1)^n*A064455(n-2)*[n>1]. (End)

Extensions

Edited by G. C. Greubel, Dec 17 2022

A124039 Triangle read by rows: T(n, k) = (-1)^floor((n+k+2)/2)*(2 - (-1)^(n+k))*A046854(n-1, k-1) with T(1, 1) = 3.

Original entry on oeis.org

3, 3, -1, -1, -3, 1, -3, 2, 3, -1, 1, 6, -3, -3, 1, 3, -3, -9, 4, 3, -1, -1, -9, 6, 12, -5, -3, 1, -3, 4, 18, -10, -15, 6, 3, -1, 1, 12, -10, -30, 15, 18, -7, -3, 1, 3, -5, -30, 20, 45, -21, -21, 8, 3, -1, -1, -15, 15, 60, -35, -63, 28, 24, -9, -3, 1
Offset: 1

Views

Author

Roger L. Bagula and Gary W. Adamson, Nov 03 2006

Keywords

Examples

			Triangle begins as:
   3;
   3,  -1;
  -1,  -3,   1;
  -3,   2,   3,  -1;
   1,   6,  -3,  -3,   1;
   3,  -3,  -9,   4,   3,  -1;
  -1,  -9,   6,  12,  -5,  -3,   1;
  -3,   4,  18, -10, -15,   6,   3, -1;
   1,  12, -10, -30,  15,  18,  -7, -3,  1;
   3,  -5, -30,  20,  45, -21, -21,  8,  3, -1;
  -1, -15,  15,  60, -35, -63,  28, 24, -9, -3,  1;
		

Crossrefs

Columns include: (-1)^n*A112030(n-1) (k=1), (-1)^floor((n+1)/2)*A064455(n) (k=2).

Programs

  • Magma
    A124039:= func< n,k | (-1)^Floor((n+k+2)/2)*(2-(-1)^(n+k))*Binomial(Floor((n+k-2)/2), k-1) + 2*0^(n-1) >;
    [A124039(n, k): k in [1..n], n in [1..12]]; // G. C. Greubel, Jan 30 2025
  • Mathematica
    (* First program *)
    f[n_, m_, d_]:= If[n==m && n>1 && m>1, 0, If[n==m-1 || n==m+1, -1, If[n==m== 1, 3, 0]]];
    M[d_]:= Table[T[n,m,d], {n,d}, {m,d}];
    A124039[n_]:= Join[{M[1]}, CoefficientList[Det[M[n] - x*IdentityMatrix[n]], x]];
    Table[A124039[n], {n,12}]//Flatten
    (* Second program *)
    A124039[n_, k_]:= (-1)^Floor[(n+k+2)/2]*(2-(-1)^(n-k))*Binomial[Floor[(n+k- 2)/2], k-1] +2*Boole[n==1];
    Table[T[n,k], {n,12}, {k,n}]//Flatten (* G. C. Greubel, Jan 30 2025 *)
  • SageMath
    @CachedFunction
    def t(n,k):
        if n< 0: return 0
        if n==0: return 1 if k == 0 else 0
        h = 3*t(n-1,k) if n==1 else 0
        return t(n-1,k-1) - t(n-2,k) - h
    def A124039(n,k): return t(n,k) + 2*0^n
    print([[A124039(n,k) for k in range(n+1)] for n in range(13)]) # Peter Luschny, Nov 20 2012
    
  • SageMath
    def A124039(n,k): return (-1)^((n+k+2)//2)*(2-(-1)^(n+k))*binomial((n+k-2)//2, k-1) + 2*0^(n-1)
    print(flatten([[A124039(n,k) for k in range(1,n+1)] for n in range(1,13)])) # G. C. Greubel, Jan 30 2025
    

Formula

T(n, k) = (-1)^floor((n+k+2)/2)*(2 - (-1)^(n+k))*A046854(n-1,k-1) + 2*[n=1]. - G. C. Greubel, Jan 30 2025

Extensions

Edited by G. C. Greubel, Jan 30 2025

A162886 Even numbers in an alternating 1-based sum up to some odd nonprime.

Original entry on oeis.org

24, 42, 54, 60, 78, 84, 96, 114, 132, 138, 144, 150, 168, 174, 180, 186, 204, 216, 222, 234, 240, 258, 264, 276, 282, 294, 306, 312, 324, 330, 348, 354, 366, 372, 384, 390, 402, 414, 420, 432, 438, 444, 450, 456, 474, 480, 486, 492, 504, 510, 516, 528, 534, 546, 558, 564
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Jul 16 2009

Keywords

Comments

Define an alternating sum S(n) = Sum_{k=0..n} (1-(-1)^k*k) = A064455(n+1).
The sequence contains this sum evaluated for an upper limit of the odd nonprimes where the sum is even.

Examples

			S(n) evaluated at n=1, 9, 15, 21, ... (taken from A014076) is 3, 15, 24, 33, 42, 51, etc., where only the even values (i.e., 24, 42, etc.) join the sequence.
		

Crossrefs

Cf. A014076.

Programs

  • Maple
    A014076 := proc(n) option remember ; if n = 1 then 1; else for a from procname(n-1)+2 by 2 do if not isprime(a) then RETURN(a) ; fi; od: fi; end:
    S := proc(n) A064455(A014076(n)+1) ; end:
    for n from 1 to 200 do if S(n) mod 2 = 0 then printf("%d,",S(n)) ; fi; od: # R. J. Mathar, Jul 21 2009

Extensions

Edited and values checked by R. J. Mathar Jul 21 2009
Previous Showing 11-20 of 22 results. Next