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

A377524 Number of steps for n to reach the minimum of its final cycle under iterations of the map (A123684): x->(3x-1)/2 if x odd, x/2 otherwise; or -1 if this never happens.

Original entry on oeis.org

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

Views

Author

Kevin Ge, Oct 28 2024

Keywords

Comments

The currently known cycle minimums are 1, 5, 17 and there are no known a(n) = -1 (trajectory never reaches a cycle).
This sequence is one way to extend A006666 (number of Collatz (3x+1)/2 steps) to the negative numbers.

Examples

			For n = 5, a(5) = 0 because 5 is already the minimum of its "final cycle".
For n = 12, a(12) = 6 because 12 takes 6 iterations to reach the minimum of its "final cycle": 12 -> 6 -> 3 -> 8 -> 4 -> 2 -> 1.
		

Crossrefs

Cf. A123684 ((3x-1)/2 map), A135730 (all steps).
Cf. A006666 (for (3x+1)/2).

Programs

  • Julia
    function three_x_minus_one_delay(n::Int)
        count = 0
        while (n != 1 && n != 5 && n != 17)
            if (isodd(n))
                n += n << 1 - 1
            end
            n >>= 1
            count += 1
        end
        return count
    end

A052928 The even numbers repeated.

Original entry on oeis.org

0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34, 34, 36, 36, 38, 38, 40, 40, 42, 42, 44, 44, 46, 46, 48, 48, 50, 50, 52, 52, 54, 54, 56, 56, 58, 58, 60, 60, 62, 62, 64, 64, 66, 66, 68, 68, 70, 70, 72, 72
Offset: 0

Views

Author

encyclopedia(AT)pommard.inria.fr, Jan 25 2000

Keywords

Comments

a(n) is also the binary rank of the complete graph K(n). - Alessandro Cosentino (cosenal(AT)gmail.com), Feb 07 2009
Let I=I_n be the n X n identity matrix and P=P_n be the incidence matrix of the cycle (1,2,3,...,n). Then, for n >= 6, a(n) is the number of (0,1) n X n matrices A <= P^(-1)+I+P having exactly two 1's in every row and column with perA=2. - Vladimir Shevelev, Apr 12 2010
a(n+2) is the number of symmetry allowed, linearly independent terms at n-th order in the series expansion of the (E+A)xe vibronic perturbation matrix, H(Q) (cf. Eisfeld & Viel). - Bradley Klee, Jul 21 2015
The arithmetic function v_2(n,1) as defined in A289187. - Robert Price, Aug 22 2017
For n > 1, also the chromatic number of the n X n white bishop graph. - Eric W. Weisstein, Nov 17 2017
For n > 2, also the maximum vertex degree of the n-polygon diagonal intersection graph. - Eric W. Weisstein, Mar 23 2018
For n >= 2, a(n+2) gives the minimum weight of a Boolean function of algebraic degree at most n-2 whose support contains n linearly independent elements. - Christof Beierle, Nov 25 2019

References

  • C. D. Godsil and G. Royle, Algebraic Graph Theory, Springer, 2001, page 181. - Alessandro Cosentino (cosenal(AT)gmail.com), Feb 07 2009
  • V. S. Shevelyov (Shevelev), Extension of the Moser class of four-line Latin rectangles, DAN Ukrainy, 3(1992),15-19.

Crossrefs

First differences: A010673; partial sums: A007590; partial sums of partial sums: A212964(n+1).
Complement of A109613 with respect to universe A004526. - Guenther Schrack, Dec 07 2017
Is first differences of A099392. Fixed point sequence: A005843. - Guenther Schrack, May 30 2019
For n >= 3, A329822(n) gives the minimum weight of a Boolean function of algebraic degree at most n-3 whose support contains n linearly independent elements. - Christof Beierle, Nov 25 2019

Programs

  • Haskell
    a052928 = (* 2) . flip div 2
    a052928_list = 0 : 0 : map (+ 2) a052928_list
    -- Reinhard Zumkeller, Jun 20 2015
  • Magma
    [2*Floor(n/2) : n in [0..50]]; // Wesley Ivan Hurt, Sep 13 2014
    
  • Maple
    spec := [S,{S=Union(Sequence(Prod(Z,Z)),Prod(Sequence(Z),Sequence(Z)))},unlabeled]: seq(combstruct[count](spec,size=n), n=0..20);
  • Mathematica
    Flatten[Table[{2n, 2n}, {n, 0, 39}]] (* Alonso del Arte, Jun 24 2012 *)
    With[{ev=2Range[0,40]},Riffle[ev,ev]] (* Harvey P. Dale, May 08 2021 *)
    Table[Round[n + 1/2], {n, -1, 72}] (* Ed Pegg Jr, Jul 28 2025 *)
  • PARI
    a(n)=n\2*2 \\ Charles R Greathouse IV, Nov 20 2011
    

Formula

a(n) = 2*floor(n/2).
G.f.: 2*x^2/((-1+x)^2*(1+x)).
a(n) + a(n+1) + 2 - 2*n = 0.
a(n) = n - 1/2 + (-1)^n/2.
a(n) = n + Sum_{k=1..n} (-1)^k. - William A. Tedeschi, Mar 20 2008
a(n) = a(n-1) + a(n-2) - a(n-3). - R. J. Mathar, Feb 19 2010
a(n) = |A123684(n) - A064455(n)| = A032766(n) - A008619(n-1). - Jaroslav Krizek, Mar 22 2011
For n > 0, a(n) = floor(sqrt(n^2+(-1)^n)). - Francesco Daddi, Aug 02 2011
a(n) = Sum_{k>=0} A030308(n,k)*b(k) with b(0)=0 and b(k)=2^k for k>0. - Philippe Deléham, Oct 19 2011
a(n) = A109613(n) - 1. - M. F. Hasler, Oct 22 2012
a(n) = n - (n mod 2). - Wesley Ivan Hurt, Jun 29 2013
a(n) = a(a(n-1)) + a(n-a(n-1)) for n>2. - Nathan Fox, Jul 24 2016
a(n) = 2*A004526(n). - Filip Zaludek, Oct 28 2016
E.g.f.: x*exp(x) - sinh(x). - Ilya Gutkovskiy, Oct 28 2016
a(-n) = -a(n+1); a(n) = A005843(A004526(n)). - Guenther Schrack, Sep 11 2018
From Guenther Schrack, May 29 2019: (Start)
a(b(n)) = b(n) + ((-1)^b(n) - 1)/2 for any sequence b(n) of offset 0.
a(a(n)) = a(n), idempotent.
a(A086970(n)) = A124356(n-1) for n > 1.
a(A000124(n)) = A192447(n+1).
a(n)*a(n+1)/2 = A007590(n), also equals partial sums of a(n).
A007590(a(n)) = 2*A008794(n). (End)

Extensions

More terms from James Sellers, Jun 05 2000
Removed duplicate of recurrence; corrected original recurrence and g.f. against offset - R. J. Mathar, Feb 19 2010

A064455 a(2n) = 3n, a(2n-1) = n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Oct 02 2001

Keywords

Comments

Also number of 1's in n-th row of triangle in A071030. - Hans Havermann, May 26 2002
Number of ON cells at generation n of 1-D CA defined by Rule 54. - N. J. A. Sloane, Aug 09 2014
a(n)*A098557(n) equals the second right hand column of A167556. - Johannes W. Meijer, Nov 12 2009
Given a(1) = 1, for all n > 1, a(n) is the least positive integer not equal to a(n-1) such that the arithmetic mean of the first n terms is an integer. The sequence of arithmetic means of the first 1, 2, 3, ..., terms is 1, 2, 2, 3, 3, 4, 4, ... (A004526 disregarding its first three terms). - Rick L. Shepherd, Aug 20 2013

Examples

			a(13) = a(2*7 - 1) = 7, a(14) = a(2*7) = 21.
a(8) = 8-9+10-11+12-13+14-15+16 = 12. - _Bruno Berselli_, Jun 05 2013
		

Crossrefs

Interleaving of A000027 and A008585 (without first term).

Programs

  • ARIBAS
    maxarg := 75; for n := 1 to maxarg do if n mod 2 = 1 then write((n+1) div 2, " ") else write((n div 2)*3," "); end; end;
    
  • GAP
    a:=[];;  for n in [1..75] do if n mod 2 = 0 then Add(a,3*n/2); else Add(a,(n+1)/2); fi; od; a; # Muniru A Asiru, Oct 28 2018
    
  • Haskell
    import Data.List (transpose)
    a064455 n = n + if m == 0 then n' else - n'  where (n',m) = divMod n 2
    a064455_list = concat $ transpose [[1 ..], [3, 6 ..]]
    -- Reinhard Zumkeller, Oct 12 2013
    
  • Magma
    [(1/2)*n*(-1)^n+n+(1/4)*(1-(-1)^n): n in [1..80]]; // Vincenzo Librandi, Aug 10 2014
    
  • Maple
    A064455 := proc(n)
        if type(n,'even') then
            3*n/2 ;
        else
            (n+1)/2 ;
        end if;
    end proc: # R. J. Mathar, Aug 03 2015
  • Mathematica
    Table[ If[ EvenQ[n], 3n/2, (n + 1)/2], {n, 1, 70} ]
  • PARI
    a(n) = { if (n%2, (n + 1)/2, 3*n/2) } \\ Harry J. Smith, Sep 14 2009
    
  • PARI
    a(n)=if(n<3,2*n-1,((n-1)*(n-2))%(2*n-1)) \\ Jim Singh, Oct 14 2018
    
  • Python
    def A064455(n): return (3*n - (2*n-1)*(n%2))//2
    print([A064455(n) for n in range(1,81)]) # G. C. Greubel, Jan 30 2025

Formula

a(n) = (1/2)*n*(-1)^n + n + (1/4)*(1 - (-1)^n). - Stephen Crowley, Aug 10 2009
G.f.: x*(1+3*x) / ( (1-x)^2*(1+x)^2 ). - R. J. Mathar, Mar 30 2011
From Jaroslav Krizek, Mar 22 2011: (Start)
a(n) = n - A123684(n-1) for odd n.
a(n) = n + a(n-1) for even n.
a(n) = A123684(n) + A137501(n).
Abs( a(n) - A123684(n) ) = A052928(n). (End)
a(n) = Sum_{i=n..2*n} i*(-1)^i. - Bruno Berselli, Jun 05 2013
a(n) = n + floor(n/2)*(-1)^(n mod 2). - Bruno Berselli, Dec 14 2015
a(n) = (n^2-3*n+2) mod (2*n-1) for n>2. - Jim Singh, Oct 31 2018
E.g.f.: (1/2)*(x*cosh(x) + (1+3*x)*sinh(x)). - G. C. Greubel, Jan 30 2025

A060036 Triangular array T read by rows: T(n,k) = k^2 mod n, for k = 1,2,...,n-1, n = 2,3,...

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 17 2001

Keywords

Comments

T(n,k) = A048152(n-1,k), 1 <= k < n; T(2*n-1,n-1) = A123684(n-1) = A225126(n-1). - Reinhard Zumkeller, Apr 29 2013

Examples

			The triangle T(n,k) begins:
n\k 1 2 3 4 5 6 7 8 9 10 11 ...
-------------------------------
2:  1
3:  1 1
4:  1 0 1
5:  1 4 4 1
6:  1 4 3 4 1
7:  1 4 2 2 4 1
6:  1 4 1 0 1 4 1
9:  1 4 0 7 7 0 4 1
10: 1 4 9 6 5 6 9 4 1
11: 1 4 9 5 3 3 5 9 4  1
12: 1 4 9 4 1 0 1 4 9  4  1
...  reformatted by - _Wolfdieter Lang_, Dec 17 2018
		

Crossrefs

Cf. A048153 (row sums).

Programs

  • Haskell
    a060036 n k = a060036_tabl !! (n-2) !! (k-1)
    a060036_row n = a060036_tabl !! (n-2)
    a060036_tabl = map init $ tail a048152_tabl
    -- Reinhard Zumkeller, Apr 29 2013
  • Mathematica
    Flatten[Table[PowerMod[k,2,n],{n,2,20},{k,n-1}]] (* Harvey P. Dale, Feb 27 2012 *)
  • PARI
    { n=1; for (m=2, 46, for (k=1, m-1, write("b060036.txt", n++, " ", k^2 % m)); ) } \\ Harry J. Smith, Jul 01 2009
    

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), Mar 20 2001

A137501 The even numbers repeated, with alternating signs.

Original entry on oeis.org

0, 0, 2, -2, 4, -4, 6, -6, 8, -8, 10, -10, 12, -12, 14, -14, 16, -16, 18, -18, 20, -20, 22, -22, 24, -24, 26, -26, 28, -28, 30, -30, 32, -32, 34, -34, 36, -36, 38, -38, 40, -40, 42, -42, 44, -44, 46, -46, 48, -48, 50, -50, 52, -52, 54, -54, 56, -56, 58, -58, 60, -60, 62, -62, 64, -64, 66, -66, 68, -68, 70, -70, 72, -72, 74
Offset: 0

Views

Author

Carlos Alberto da Costa Filho (cacau_dacosta(AT)hotmail.com), Apr 22 2008

Keywords

Comments

The general formula for alternating sums of powers of even integers is in terms of the Swiss-Knife polynomials P(n,x) A153641 (P(n,1)-(-1)^k P(n,2k+1))/2. Here n=1 and k shifted one place, thus a(k) = (P(1,1)-(-1)^(k-1) P(1,2(k-1)+1))/2. - Peter Luschny, Jul 12 2009
With just one 0 at the beginning, this is a permutation of all the even integers. - Alonso del Arte, Jun 24 2012

Crossrefs

Programs

  • Maple
    den:= n -> (n-1/2+1/2*(-1)^n)*(-1)^n: seq(den(n),n=-10..10);
    a := n -> (1+(-1)^n*(2*n-1))/2; # Peter Luschny, Jul 12 2009
  • Mathematica
    Flatten[Table[{2n, -2n}, {n, 0, 39}]] (* Alonso del Arte, Jun 24 2012 *)
    With[{enos=2*Range[0,40]},Riffle[enos,-enos]] (* Harvey P. Dale, Oct 12 2014 *)

Formula

a(n) = ( n - (1/2) + (1/2)*(-1)^n )*(-1)^n.
From R. J. Mathar, Feb 14 2010: (Start)
a(n) = -a(n-1) + a(n-2) + a(n-3).
G.f.: 2*x^2/((1-x) * (1+x)^2). (End)
a(n) = A064455(n) - A123684(n). - Jaroslav Krizek, Mar 22 2011

A225126 Central terms of the triangle in A048152.

Original entry on oeis.org

0, 1, 4, 2, 7, 3, 10, 4, 13, 5, 16, 6, 19, 7, 22, 8, 25, 9, 28, 10, 31, 11, 34, 12, 37, 13, 40, 14, 43, 15, 46, 16, 49, 17, 52, 18, 55, 19, 58, 20, 61, 21, 64, 22, 67, 23, 70, 24, 73, 25, 76, 26, 79, 27, 82, 28, 85, 29, 88, 30, 91, 31, 94, 32, 97, 33, 100
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 29 2013

Keywords

Comments

a(n) = A123684(n) for n > 1;
a(n) = A048152(2*n-1,n), central terms;
also a(n) = A060036(2*n-1,n-1) for n > 1.
a(n+1)=the remainder when n^2 is divided by 2n+1. - J. M. Bergot, Jun 25 2013

Programs

Formula

a(1) = 0, a(2*n) = n and a(2*n+1) = 3*n+1.
a(n) = 2*a(n-2)-a(n-4) for n>5. G.f.: -x^2*(x^3-4*x-1) / ((x-1)^2*(x+1)^2). - Colin Barker, May 01 2013

A123685 Counts compositions as described by table A047969; however, only those ending with an odd part are considered.

Original entry on oeis.org

1, 1, 0, 1, 1, 1, 1, 3, 4, 0, 1, 7, 14, 2, 1, 1, 15, 46, 14, 7, 0, 1, 31, 146, 74, 43, 3, 1, 1, 63, 454, 350, 247, 33, 10, 0, 1, 127, 1394, 1562, 1363, 273, 88, 4, 1, 1, 255, 4246, 6734, 7327, 2013, 724, 60, 13, 0, 1, 511, 12866, 28394, 38683, 13953, 5716, 676, 149, 5, 1, 1
Offset: 1

Views

Author

Alford Arnold, Oct 11 2006

Keywords

Examples

			Row four of table A047969 counts the 14 compositions
4
31 13 32 23 33
211 121 112 221 212 122 222
1111
whereas A123685 only counts
31 13 32 33
121 112 122
and 1111
		

Crossrefs

Diagonals include A000012, A059841, A000225, A123684 and A027649.

Programs

  • Maple
    g:= proc(b, t, l, m) option remember; `if`(t=0, b*l, add(
          g(b, t-1, irem(k, 2), m), k=1..m-1)+g(1, t-1, irem(m, 2), m))
        end:
    A:= (n, k)-> g(0, k, 0, n):
    seq(seq(A(n, d+1-n), n=1..d), d=1..13); # Alois P. Heinz, Nov 06 2009
  • Mathematica
    g[b_, t_, l_, m_] := g[b, t, l, m] = If[t == 0, b*l, Sum[g[b, t-1, Mod[k, 2], m], {k, 1, m-1}] + g[1, t-1, Mod[m, 2], m]]; A[n_, k_] := g[0, k, 0, n]; Table [Table [A[n, d+1-n], {n, 1, d}], {d, 1, 13}] // Flatten (* Jean-François Alcover, Feb 20 2015, after Alois P. Heinz *)

Extensions

More terms from Alois P. Heinz, Nov 06 2009

A128621 A127648 * A128174 as an infinite lower triangular matrix.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Mar 14 2007

Keywords

Examples

			First few rows of the triangle:
  1;
  0, 2;
  3, 0, 3;
  0, 4, 0, 4;
  5, 0, 5, 0, 5;
  ...
		

Crossrefs

Cf. A093005 (row sums).

Programs

  • Magma
    [n*(1+(-1)^(n+k))/2: k in [1..n], n in [1..15]]; // G. C. Greubel, Mar 13 2024
    
  • Mathematica
    Table[n*(1+(-1)^(n+k))/2, {n,15}, {k,n}]//Flatten (* G. C. Greubel, Mar 13 2024 *)
  • SageMath
    flatten([[n*(1+(-1)^(n+k))//2 for k in range(1,n+1)] for n in range(1,16)]) # G. C. Greubel, Mar 13 2024

Formula

Odd rows: n terms of n, 0, n, ...; even rows, n terms of 0, n, 0, ...
T(n,k) = n if n+k even, T(n,k) = 0 if n+k odd.
Sum_{k=1..n} T(n, k) = A093005(n) (row sums).
From G. C. Greubel, Mar 13 2024: (Start)
T(n, k) = n*(1 + (-1)^(n+k))/2.
Sum_{k=1..n} (-1)^(k-1)*T(n, k) = (-1)^(n+1)*A093005(n).
Sum_{k=1..floor((n+1)/2)} T(n-k+1, k) = (1/2)*(1-(-1)^n) * A000326(floor((n+1)/2)).
Sum_{k=1..floor((n+1)/2)} (-1)^(k-1)*T(n-k+1, k) = (1/2)*(1 - (-1)^n)*A123684(floor((n+1)/2)). (End)

Extensions

More terms added by G. C. Greubel, Mar 13 2024

A319556 a(n) gives the alternating sum of length n, starting at n: n - (n+1) + (n+2) - ... + (-1)^(n+1) * (2n-1).

Original entry on oeis.org

1, -1, 4, -2, 7, -3, 10, -4, 13, -5, 16, -6, 19, -7, 22, -8, 25, -9, 28, -10, 31, -11, 34, -12, 37, -13, 40, -14, 43, -15, 46, -16, 49, -17, 52, -18, 55, -19, 58, -20, 61, -21, 64, -22, 67, -23, 70, -24, 73, -25, 76, -26, 79, -27, 82, -28, 85, -29, 88, -30
Offset: 1

Views

Author

Mark Povich, Aug 27 2019

Keywords

Comments

As can be observed from Bernard Schott's formula, and also proved using elementary methods of slope and angle determination, extending the graph of this sequence forms two lines (given by y = 1.5x - 0.5 and y = -0.5x) that intersect at (0.25, -0.125) in an angle of intersection of ~82.87 degrees. The angles of incidence of these lines off the horizontal axis are ~56.31 and ~-26.56 degrees.
If one wished to include negative input values, one could proceed, e.g., -3+4-5 (=-8) or -3+2-1 (=-2). If the former, then the sequence merely switches signs for negative inputs, graphically extending the previous lines to the left of the vertical. If the latter, two new lines emerge left of the vertical, both of slope 1/2. Increasing the run in this case "spreads apart" all y-intercepts.

Examples

			If n=5, a(n)=7, since 5-6+7-8+9 = 7.
If n=6, a(n)=-3, since 6-7+8-9+10-11 = -3.
		

Crossrefs

Programs

  • Magma
    [((2*n-1)*(n mod 2) - n*(-1)^n)/2: n in [0..70]]; // G. C. Greubel, Mar 14 2024
    
  • Mathematica
    LinearRecurrence[{0,2,0,-1}, {1,-1,4,-2}, 60] (* Metin Sariyar, Sep 15 2019 *)
  • PARI
    a(n) = sum(k=n, 2*n-1, (-1)^(n-k)*k); \\ Michel Marcus, Aug 27 2019
    
  • PARI
    Vec(x*(1 - x + 2*x^2) / ((1 - x)^2*(1 + x)^2) + O(x^60)) \\ Colin Barker, Sep 07 2019
    
  • Python
    def alt(k):
        return sum(k[::2])-sum(k[1::2])
    def alt_run(n):
        m = []
        m.append(n)
        for i in range (1, n):
            m.append(m[0]+i)
        return alt(m)
    t=[]
    for i in range (100):
        t.append(alt_run(i))
    print(t)
    
  • SageMath
    [((2*n-1)*(n%2) - n*(-1)^n)/2 for n in range(1,71)] # G. C. Greubel, Mar 14 2024

Formula

From Bernard Schott, Aug 27 2019: (Start)
a(2*n-1) = 3*n-2 for n >= 1,
a(2*n) = - n for n >= 1. (End)
a(n) = Sum_{k=n..2*n-1} (-1)^(n-k)*k.
From Colin Barker, Sep 07 2019: (Start)
G.f.: x*(1 - x + 2*x^2) / ((1 - x)^2*(1 + x)^2).
a(n) = 2*a(n-2) - a(n-4) for n>4.
a(n) = ((2*n-1)*(1 - (-1)^n) - 2*n*(-1)^n)/4. (End)
E.g.f.: (1/4)*((1 + 4*x)*exp(-x) - (1 - 2*x)*exp(x)). - Stefano Spezia, Sep 07 2019 after Colin Barker
From G. C. Greubel, Mar 14 2024: (Start)
a(n) = Sum_{k=0..n-1} (-1)^k*A094727(n, k).
a(n) = Sum_{k=1..n} (-1)^(k-1)*A128622(n, k). (End)

A128622 Triangle T(n, k) = A128064(unsigned) * A128174, read by rows.

Original entry on oeis.org

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

Views

Author

Gary W. Adamson, Mar 14 2007

Keywords

Examples

			First few rows of the triangle are:
  1;
  1, 2;
  3, 2, 3;
  3, 4, 3, 4;
  5, 4, 5, 4, 5;
  5, 6, 5, 6, 5, 6;
  7, 6, 7, 6, 7, 6, 7;
  ...
		

Crossrefs

Cf. A000326 (diagonal sums), A014848 (row sums), A319556 (alternating row sums).

Programs

  • Magma
    [n - ((n+k) mod 2): k in [1..n], n in [1..16]]; // G. C. Greubel, Mar 14 2024
    
  • Mathematica
    Table[n - Mod[n+k,2], {n,16}, {k,n}]//Flatten (* G. C. Greubel, Mar 14 2024 *)
  • SageMath
    flatten([[n - ((n+k)%2) for k in range(1,n+1)] for n in range(1,16)]) # G. C. Greubel, Mar 14 2024

Formula

T(n, k) = abs(A128064(n,k) * A128174(n, k), as infinite lower triangular matrices.
Sum_{k=1..n} T(n, k) = A014848(n) (row sums).
From G. C. Greubel, Mar 14 2024: (Start)
T(n, k) = n - (1 - (-1)^(n+k))/2 = n - (n+k mod 2).
T(n, 1) = A109613(n+1).
T(n, n) = A000027(n).
T(2*n-1, n) = A042963(n).
T(3*n-1, n) = A016777(n+1).
T(4*n-3, n) = A047461(n).
Sum_{k=1..n} (-1)^(k-1)*T(n, k) = A319556(n).
Sum_{k=1..floor((n+1)/2)} T(n-k+1, k) = A000326(floor((n+1)/2)).
Sum_{k=1..floor((n+1)/2)} (-1)^(k-1)*T(n-k+1, k) = A123684(floor((n+1)/2)). (End)

Extensions

More terms added by G. C. Greubel, Mar 14 2024
Showing 1-10 of 13 results. Next