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 10 results.

A042965 Nonnegative integers not congruent to 2 mod 4.

Original entry on oeis.org

0, 1, 3, 4, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 51, 52, 53, 55, 56, 57, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92
Offset: 1

Views

Author

Keywords

Comments

Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence (starting at 3) gives values of AUB, sorted and duplicates removed. Values of AUBUC give same sequence. - David W. Wilson
These are the nonnegative integers that can be written as a difference of two squares, i.e., n = x^2 - y^2 for integers x,y. - Sharon Sela (sharonsela(AT)hotmail.com), Jan 25 2002. Equivalently, nonnegative numbers represented by the quadratic form x^2-y^2 of discriminant 4. The primes in this sequence are all the odd primes. - N. J. A. Sloane, May 30 2014
Numbers n such that Kronecker(4,n) == mu(gcd(4,n)). - Jon Perry, Sep 17 2002
Count, sieving out numbers of the form 2*(2*n+1) (A016825, "nombres pair-impairs"). A generalized Chebyshev transform of the Jacobsthal numbers: apply the transform g(x) -> (1/(1+x^2)) g(x/(1+x^2)) to the g.f. of A001045(n+2). Partial sums of 1,2,1,1,2,1,.... - Paul Barry, Apr 26 2005
For n>1, equals union of A020883 and A020884. - Lekraj Beedassy, Sep 28 2004
The sequence 1,1,3,4,5,... is the image of A001045(n+1) under the mapping g(x) -> g(x/(1+x^2)). - Paul Barry, Jan 16 2005
With offset 0 starting (1, 3, 4,...) = INVERT transform of A009531 starting (1, 2, -1, -4, 1, 6,...) with offset 0.
Apparently these are the regular numbers modulo 4 [Haukkanan & Toth]. - R. J. Mathar, Oct 07 2011
Numbers of the form x*y in nonnegative integers x,y with x+y even. - Michael Somos, May 18 2013
Convolution of A106510 with A000027. - L. Edson Jeffery, Jan 24 2015
Numbers that are the sum of zero or more consecutive odd positive numbers. - Gionata Neri, Sep 01 2015
Numbers that are congruent to {0, 1, 3} mod 4. - Wesley Ivan Hurt, Jun 10 2016
Nonnegative integers of the form (2+(3*m-2)/4^j)/3, j,m >= 0. - L. Edson Jeffery, Jan 02 2017
This is { x^2 - y^2; x >= y >= 0 }; with the restriction x > y one gets the same set without zero; with the restriction x > 0 (i.e., differences of two nonzero squares) one gets the set without 1. An odd number 2n-1 = n^2 - (n-1)^2, a number 4n = (n+1)^2 - (n-1)^2. - M. F. Hasler, May 08 2018

Examples

			G.f. = x^2 + 3*x^3 + 4*x^4 + 5*x^5 + 7*x^6 + 8*x^7 + 9*x^8 + 11*x^9 + 12*x^10 + ...
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section D9.
  • J. V. Uspensky and M. A. Heaslet, Elementary Number Theory, McGraw-Hill, NY, 1939, p. 83.

Crossrefs

Essentially the complement of A016825.
See A267958 for these numbers multiplied by 4.

Programs

  • Haskell
    a042965 =  (`div` 3) . (subtract 3) . (* 4)
    a042965_list = 0 : 1 : 3 : map (+ 4) a042965_list
    -- Reinhard Zumkeller, Nov 09 2012
    
  • Magma
    [n: n in [0..100] | not n mod 4 in [2]]; // Vincenzo Librandi, Sep 03 2015
    
  • Maple
    a_list := proc(len) local rec; rec := proc(n) option remember;
    ifelse(n <= 4, [0, 1, 3, 4][n], rec(n-1) + rec(n-3) - rec(n-4)) end:
    seq(rec(n), n=1..len) end: a_list(76); # Peter Luschny, Aug 06 2022
  • Mathematica
    nn=100; Complement[Range[0,nn], Range[2,nn,4]] (* Harvey P. Dale, May 21 2011 *)
    f[n_]:=Floor[(4*n-3)/3]; Array[f,70] (* Robert G. Wilson v, Jun 26 2012 *)
    LinearRecurrence[{1, 0, 1, -1}, {0, 1, 3, 4}, 70] (* L. Edson Jeffery, Jan 21 2015 *)
    Select[Range[0, 100], ! MemberQ[{2}, Mod[#, 4]] &] (* Vincenzo Librandi, Sep 03 2015 *)
  • PARI
    a(n)=(4*n-3)\3 \\ Charles R Greathouse IV, Jul 25 2011
    
  • Python
    def A042965(n): return (n<<2)//3-1 # Chai Wah Wu, Feb 10 2025

Formula

Recurrence: a(n) = a(n-1) + a(n-3) - a(n-4) for n>4.
a(n) = n - 1 + (3n-3-sqrt(3)*(1-2*cos(2*Pi*(n-1)/3))*sin(2*Pi*(n-1)/3))/9. Partial sums of the period-3 sequence 0, 1, 1, 2, 1, 1, 2, 1, 1, 2, ... (A101825). - Ralf Stephan, May 19 2013
G.f.: A(x) = x^2*(1+x)^2/((1-x)^2*(1+x+x^2)); a(n)=Sum{k=0..floor(n/2)}, binomial(n-k-1, k)*A001045(n-2*k), n>0. - Paul Barry, Jan 16 2005, R. J. Mathar, Dec 09 2009
a(n) = floor((4*n-3)/3). - Gary Detlefs, May 14 2011
A214546(a(n)) != 0. - Reinhard Zumkeller, Jul 20 2012
From Michael Somos, May 18 2013: (Start)
Euler transform of length 3 sequence [3, -2, 1].
a(2-n) = -a(n). (End)
From Wesley Ivan Hurt, Jun 10 2016: (Start)
a(n) = (12*n-12+3*cos(2*n*Pi/3)+sqrt(3)*sin(2*n*Pi/3))/9.
a(3k) = 4k-1, a(3k-1) = 4k-3, a(3k-2) = 4k-4. (End)
a(n) = round((4*n-4)/3). - Mats Granvik, Sep 24 2016
The g.f. A(x) satisfies (A(x)/x)^2 + A(x)/x = x*B(x)^2, where B(x) is the o.g.f. of A042968. - Peter Bala, Apr 12 2017
Sum_{n>=2} (-1)^n/a(n) = log(sqrt(2)+2)/sqrt(2) - (sqrt(2)-1)*log(2)/4. - Amiram Eldar, Dec 05 2021
From Peter Bala, Aug 03 2022: (Start)
a(n) = a(floor(n/2)) + a(1 + ceiling(n/2)) for n >= 2, with a(2) = 1 and a(3) = 3.
a(2*n) = a(n) + a(n+1); a(2*n+1) = a(n) + a(n+2). Cf. A047222 and A006165. (End)
E.g.f.: (9 + 12*exp(x)*(x - 1) + exp(-x/2)*(3*cos(sqrt(3)*x/2) + sqrt(3)*sin(sqrt(3)*x/2)))/9. - Stefano Spezia, Apr 05 2023

Extensions

Edited by N. J. A. Sloane at the suggestion of Andrew S. Plewe, Peter Pein and Ralf Stephan, Jun 17 2007
Typos fixed in Gary Detlefs's formula and in PARI program by Reinhard Zumkeller, Nov 09 2012

A029578 The natural numbers interleaved with the even numbers.

Original entry on oeis.org

0, 0, 1, 2, 2, 4, 3, 6, 4, 8, 5, 10, 6, 12, 7, 14, 8, 16, 9, 18, 10, 20, 11, 22, 12, 24, 13, 26, 14, 28, 15, 30, 16, 32, 17, 34, 18, 36, 19, 38, 20, 40, 21, 42, 22, 44, 23, 46, 24, 48, 25, 50, 26, 52, 27, 54, 28, 56, 29, 58, 30, 60, 31, 62, 32, 64, 33, 66, 34, 68, 35, 70, 36, 72
Offset: 0

Views

Author

Keywords

Comments

a(n) = number of ordered, length two, compositions of n with at least one odd summand - Len Smiley, Nov 25 2001
Also number of 0's in n-th row of triangle in A071037. - Hans Havermann, May 26 2002
For n > 2: a(n) = number of odd terms in row n-2 of triangle A265705. - Reinhard Zumkeller, Dec 15 2015

Crossrefs

Cf. A065423 (at least one even summand).
Cf. A001477, A005843, A009531, A071037, A211538 (partial sums), A265705.

Programs

  • Haskell
    import Data.List (transpose)
    a029578 n =  (n - n `mod` 2) `div` (2 - n `mod` 2)
    a029578_list = concat $ transpose [a001477_list, a005843_list]
    -- Reinhard Zumkeller, Nov 27 2012
    
  • Magma
    A029578:= func< n | (n + (n-2)*(n mod 2))/2 >;
    [A029578(n): n in [0..80]]; // G. C. Greubel, Jan 22 2025
    
  • Mathematica
    With[{nn=40},Riffle[Range[0,nn],Range[0,2nn,2]]] (* or *) LinearRecurrence[ {0,2,0,-1},{0,0,1,2},80] (* Harvey P. Dale, Aug 23 2015 *)
  • PARI
    a(n)=if(n%2,n-1,n/2)
    
  • Python
    def A029578(n): return (n + (n-2)*(n%2))//2
    print([A029578(n) for n in range(81)]) # G. C. Greubel, Jan 22 2025

Formula

a(n) = (3*n - 2 - (-1)^n*(n - 2))/4.
a(n+4) = 2*a(n+2) - a(n).
G.f.: x^2*(1 + 2*x)/(1-x^2)^2.
a(n) = floor((n+1)/2) + (n is odd)*floor((n+1)/2).
a(n) = (n - n mod 2)/(2 - n mod 2). - Reinhard Zumkeller, Jul 30 2002
a(n) = floor(n/2)*binomial(2, mod(n, 2)) - Paul Barry, May 25 2003
a(2*n) = n.
a(2*n-1) = 2*n-2.
a(-n) = -A065423(n+2).
a(n) = Sum_{k=0..floor((n-2)/2)} (C(n-k-2, k) mod 2)((1+(-1)^k)/2)*2^A000120(n-2k-2). - Paul Barry, Jan 06 2005
a(n) = Sum_{k=0..n-2} gcd(n-k-1, k+1). - Paul Barry, May 03 2005
For n>6: a(n) = floor(a(n-1)*a(n-2)/a(n-3)). - Reinhard Zumkeller, Mar 06 2011
E.g.f.: (1/4)*((x+2)*exp(-x) + (3*x-2)*exp(x)). - G. C. Greubel, Jan 22 2025

Extensions

Explicated definition by Reinhard Zumkeller, Nov 27 2012
Title simplified by Sean A. Irvine, Feb 29 2020

A049240 Smallest nonnegative value taken on by x^2 - n*y^2 for an infinite number of integer pairs (x, y).

Original entry on oeis.org

0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1
Offset: 1

Views

Author

Keywords

Comments

Encodes to 1,2,1,4,1,6,1,8,1,10,...: unsigned version of A009531. - Paul Barry, Oct 12 2005
Parity of inverse Moebius transform of Jacobsthal numbers J(k) less J(n). - Paul Barry, Oct 12 2005

Crossrefs

Characteristic function of A000037 (the nonsquares).

Programs

  • Magma
    [Floor((1 + Ceiling(Sqrt(n)) - Floor(Sqrt(n)))/2) : n in [1..100]]; // Wesley Ivan Hurt, Sep 27 2014
    
  • Maple
    A049240:=n->`if`(issqr(n),0,1): seq(A049240(n), n=1..100); # Wesley Ivan Hurt, Sep 27 2014
  • Mathematica
    Differences[Table[n - Ceiling[Sqrt[n]], {n, 105}]] (* Arkadiusz Wesolowski, Oct 30 2012 *)
    Table[Floor[(1 + Ceiling[Sqrt[n]] - Floor[Sqrt[n]])/2], {n, 70}] (* Wesley Ivan Hurt, Sep 27 2014 *)
  • Python
    from math import isqrt
    def A049240(n): return int(isqrt(n)**2!=n) # Chai Wah Wu, Jun 14 2022

Formula

a(n) = 0 if n is square, 1 otherwise.
a(n) = (A001045(n) - Sum_{k|n} A001045(k)) mod 2. - Paul Barry, Oct 12 2005
a(n) = 1 - A010052(n). - R. J. Mathar, Jul 04 2009
a(n) = floor(1+ceiling(sqrt(n))-floor(sqrt((n)))/2). - Wesley Ivan Hurt, Sep 27 2014
G.f.: (1+x)/(2-2*x) - (1/2)*theta_3(0,x) where theta_3 is a Jacobi theta function. - Robert Israel, Oct 02 2014

A124625 Even numbers sandwiched between 1's.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jun 13 2007

Keywords

Comments

Interleaving of A000012 and A005843.
Created to simplify the definition of A129952.
a(n) = abs(A009531(n-1)).
Starting (1, 2, 1, 4,...): square (1 + x - x^2 - x^3 + x^4 + x^5 - ...) = (1 + 2x - x^2 - 4x^3 + x^4 + 6x^5 - ...).
With a(3) taken as 0, a(n+2) = n^k+1 mod 2*n, n>=1, for any k>=2, also for k=n. - Wolfdieter Lang, Dec 21 2011
Also !(n+2) mod n for n>0 where !n is a subfactorial number (A000166). - Michel Lagneau, Sep 05 2012
Greatest common divisor of n-1 and (n-1) mod 2. - Bruno Berselli, Mar 07 2017

References

  • Murat Sahin and Elif Tan, Conditional (strong) divisibility sequences, Fib. Q., 56 (No. 1, 2018), 18-31.

Crossrefs

Cf. A000012 (all 1's), A005843 (even numbers), A009531, A093178, A152271.

Programs

  • Magma
    &cat[[1, 2*k]: k in [0..42]];
    
  • Maple
    A124625:=n->(n-(n-2)*(-1)^n)/2; seq(A124625(k), k=0..100); # Wesley Ivan Hurt, Oct 19 2013
  • Mathematica
    Join[{1},Riffle[2Range[0,50],1]] (* Harvey P. Dale, Nov 02 2011 *)
  • PARI
    {for(n=0, 85, print1(if(n%2>0, n-1, 1), ","))}
    
  • Python
    print([(n-1)**(n%2) for n in range(0, 86)]) # Karl V. Keller, Jr., Jul 26 2020

Formula

a(n) = 1 for even n, a(n) = n-1 for odd n.
a(2*k) = 1, a(2*k+1) = 2*k.
G.f.: (1 - x^2 + 2*x^3)/((1 - x)^2*(1 + x)^2).
a(n) = (n - (n - 2)*(-1)^n)/2. - Bruno Berselli, May 06 2011
E.g.f.: 1 + x^2*U(0)/2 where U(k) = 1 + 2*x*(k+1)/(2*k + 3 - x*(2*k+3)/(x + 4*(k+2)*(k+1)/U(k+1))) (continued fraction, 3rd kind, 3-step). - Sergei N. Gladkovskii, Oct 20 2012
a(n) = 2*floor(n/2) - (n-1)*((n-1) mod 2). - Wesley Ivan Hurt, Oct 19 2013
a(n) = (n-1)^((1-(-1)^n)/2). - Wesley Ivan Hurt, Mar 21 2015
a(n) = (n-1) - a(a(n-1))*a(n-1), a(0) = 0. - Eli Jaffe, Jun 07 2016
E.g.f.: (x + 1)*cosh(x) - sinh(x). - Ilya Gutkovskiy, Jun 07 2016
a(n) = (-1)^n mod n for n > 0. - Franz Vrabec, Mar 06 2020
a(n) = (n-1)^(n mod 2). - Karl V. Keller, Jr., Aug 01 2020

Extensions

More terms from Klaus Brockhaus, Jun 16 2007
Edited by N. J. A. Sloane, May 21 2008 at the suggestion of R. J. Mathar

A086622 G.f. A(x) satisfies: A(x) = 1/(1-2*x) + x^2*A(x)^2.

Original entry on oeis.org

1, 2, 5, 12, 30, 76, 197, 520, 1398, 3820, 10594, 29768, 84620, 243000, 704045, 2055760, 6043750, 17875020, 53148310, 158773320, 476311940, 1434313960, 4333867170, 13135533552, 39924668220, 121661345656, 371612931492
Offset: 0

Views

Author

Paul D. Hanna, Jul 24 2003

Keywords

Comments

a(n) is the number of Motzkin paths of length n having no (1,0)-steps at levels 1,3,5,... and having (1,0)-steps of two colors at levels 2,4,6,... . Example: a(3) = 12 because, denoting U=(1,1), D=(1,-1), and H=(1,0), we have 8 paths of shape HHH, 2 paths of shape HUD, and 2 paths of shape UDH. - Emeric Deutsch, May 02 2011

Crossrefs

Cf. A086620 (table), A086621 (diagonal).

Programs

  • Maple
    A086622 := proc(n)
        option remember;
        if n < 3 then
            op(n+1,[1,2,5]) ;
        else
            4*(-n-1)*procname(n-1) +4*procname(n-2) +4*(2*n-3)*procname(n-3) ;
            -%/(n+2) ;
        end if;
    end proc:
    seq(A086622(n),n=0..20) ; # R. J. Mathar, Nov 02 2021
  • Mathematica
    CoefficientList[Series[(-1+2*x+Sqrt[1-4*x+8*x^3])/(2*(-x^2+2*x^3)), {x, 0, 20}], x] (* Vaclav Kotesovec, Feb 13 2014 *)

Formula

Antidiagonal sums of square table A086620.
a(n) = Sum_{k=0..floor(n/2)} C(n-k,k) C(2k,k) 2^(n-2k)/(k+1). - Paul Barry, Nov 13 2004
Hankel transform of a(n) is 1,1,1,....; Hankel transform of a(n+1) is A009531(n+2). - Paul Barry, Nov 06 2007
G.f.: 1/(1-2*x-x^2/(1-x^2/(1-2*x-x^2/(1-x^2/(1-2*x-x^2/..... (continued fraction). - Paul Barry, Dec 21 2008
D-finite with recurrence (n+2)*a(n) +4*(-n-1)*a(n-1) +4*a(n-2) +4*(2*n-3)*a(n-3)=0. - R. J. Mathar, Nov 24 2012
G.f.: (-1+2*x+sqrt(1-4*x+8*x^3))/(2*(-x^2+2*x^3)). - Vaclav Kotesovec, Feb 13 2014
a(n) ~ sqrt(50+22*sqrt(5)) * (sqrt(5)+1)^n / (2 * sqrt(Pi) * n^(3/2)). - Vaclav Kotesovec, Feb 13 2014. Equivalently, a(n) ~ 5^(1/4) * 2^n * phi^(n + 5/2) / (sqrt(Pi) * n^(3/2)), where phi = A001622 is the golden ratio. - Vaclav Kotesovec, Dec 07 2021
a(n) = Sum_{i=0..floor(n/2)}2^(n-2i)*C(i)*binomial(n-i,i), where C(n) is the n-th Catalan number A000108. - José Luis Ramírez Ramírez, Apr 20 2015

A144678 Related to enumeration of quantum states (see reference for precise definition).

Original entry on oeis.org

1, 2, 3, 4, 7, 10, 13, 16, 22, 28, 34, 40, 50, 60, 70, 80, 95, 110, 125, 140, 161, 182, 203, 224, 252, 280, 308, 336, 372, 408, 444, 480, 525, 570, 615, 660, 715, 770, 825, 880, 946, 1012, 1078, 1144, 1222, 1300, 1378, 1456, 1547, 1638, 1729, 1820, 1925, 2030, 2135
Offset: 0

Views

Author

N. J. A. Sloane, Feb 06 2009

Keywords

Comments

The Gi2 triangle sums of the triangle A159797 are linear sums of shifted versions of the sequence given above, i.e., Gi2(n) = a(n-1) + 2*a(n-2) + 2*a(n-3) + 3*a(n-4) + a(n-5). For the definitions of the Gi2 and other triangle sums see A180662. [Johannes W. Meijer, May 20 2011]
Partial sums of 1,1,1,1, 3,3,3,3, 6,6,6,6,..., the quadruplicated A000217. - R. J. Mathar, Aug 25 2013
Number of partitions of n into two different parts of size 4 and two different parts of size 1. a(4) = 7: 4, 4', 1111, 1111', 111'1', 11'1'1', 1'1'1'1'. - Alois P. Heinz, Dec 22 2021

Crossrefs

Programs

  • Magma
    R:=PowerSeriesRing(Integers(), 60); Coefficients(R!( 1/((1-x)*(1-x^4))^2 )); // G. C. Greubel, Oct 18 2021
    
  • Maple
    n:=80; lambda:=4; S10b:=[];
    for ii from 0 to n do
    x:=floor(ii/lambda);
    snc:=1/6*(x+1)*(x+2)*(3*ii-2*x*lambda+3);
    S10b:=[op(S10b),snc];
    od:
    S10b;
    A144678 := proc(n) option remember;
       local k;
       sum(A190718(n-k),k=0..3)
    end:
    A190718:= proc(n)
       binomial(floor(n/4)+3,3)
    end:
    seq(A144678(n),n=0..54); # Johannes W. Meijer, May 20 2011
  • Mathematica
    a[n_] = (r = Mod[n, 4]; (4+n-r)(8+n-r)(3+n+2r)/96); Table[a[n], {n, 0, 54}] (* Jean-François Alcover, Sep 02 2011 *)
    LinearRecurrence[{2,-1,0,2,-4,2,0,-1,2,-1}, {1,2,3,4,7,10,13,16,22,28}, 60] (* G. C. Greubel, Oct 18 2021 *)
  • PARI
    Vec(1/(x-1)^4/(x^3+x^2+x+1)^2+O(x^99)) \\ Charles R Greathouse IV, Jun 20 2013
    
  • Sage
    def A144678_list(prec):
        P. = PowerSeriesRing(ZZ, prec)
        return P( 1/((1-x)*(1-x^4))^2 ).list()
    A144678_list(60) # G. C. Greubel, Oct 18 2021

Formula

From Johannes W. Meijer, May 20 2011: (Start)
a(n) = A190718(n-3) + A190718(n-2) + A190718(n-1) + A190718(n).
a(n-3) + a(n-2) + a(n-1) + a(n) = A122046(n+3).
G.f.: 1/((x-1)^4*(x^3+x^2+x+1)^2). (End)
a(n) = A009531(n+5)/16 + (n+5)*(2*n^2+20*n+33+3*(-1)^n)/192 . - R. J. Mathar, Jun 20 2013
a(n) = Sum_{i=1..n+8} floor(i/4) * floor((n+8-i)/4). - Wesley Ivan Hurt, Jul 21 2014
From Alois P. Heinz, Dec 22 2021: (Start)
G.f.: 1/((1-x)*(1-x^4))^2.
a(n) = Sum_{j=0..floor(n/4)} (j+1)*(n-4*j+1). (End)

A009001 Expansion of e.g.f: (1+x)*cos(x).

Original entry on oeis.org

1, 1, -1, -3, 1, 5, -1, -7, 1, 9, -1, -11, 1, 13, -1, -15, 1, 17, -1, -19, 1, 21, -1, -23, 1, 25, -1, -27, 1, 29, -1, -31, 1, 33, -1, -35, 1, 37, -1, -39, 1, 41, -1, -43, 1, 45, -1, -47, 1, 49, -1, -51, 1, 53, -1, -55, 1, 57, -1, -59, 1, 61, -1, -63, 1, 65, -1, -67, 1, 69, -1, -71, 1, 73, -1, -75, 1, 77, -1, -79, 1, 81, -1, -83, 1, 85
Offset: 0

Views

Author

Keywords

Comments

If signs are ignored, continued fraction for tan(1) (cf. A093178).

Examples

			tan(1) = 1.557407724654902230... = 1 + 1/(1 + 1/(1 + 1/(3 + 1/(1 + ...)))). - _Harry J. Smith_, Jun 15 2009
G.f. = 1 + x - x^2 - 3*x^3 + x^4 + 5*x^5 - x^6 - 7*x^7 + x^8 + 9*x^9 - x^10 + ...
		

Crossrefs

Cf. A009531, A049471 (decimal expansion of tan(1)).

Programs

  • Magma
    m:=50; R:=PowerSeriesRing(Rationals(), m); b:=Coefficients(R!((1+x)*Cos(x))); [Factorial(n-1)*b[n]: n in [1..m]]; // G. C. Greubel, Jul 21 2018
  • Maple
    seq(coeff(series(factorial(n)*(1+x)*cos(x), x,n+1),x,n),n=0..90); # Muniru A Asiru, Jul 21 2018
  • Mathematica
    With[{nn=90},CoefficientList[Series[(1+x)Cos[x],{x,0,nn}],x]Range[0,nn]!] (* Harvey P. Dale, Jul 15 2012 *)
    LinearRecurrence[{0, -2, 0, -1}, {1, 1, -1, -3}, 100] (* Jean-François Alcover, Feb 21 2020 *)
    FoldList[If[Mod[#2, 4]==1, #1*#2, If[Mod[#2, 4]==2, #1-#2,If[Mod[#2,4] ==3,#1*#2,#1+#2]]]&, 1, Range[1, 85]] (* James C. McMahon, Oct 12 2023 *)
  • PARI
    {a(n) = (-1)^(n\2) * if( n%2, n, 1)} /* Michael Somos, Oct 16 2006 */
    

Formula

a(n) = (-1)^(n/2) if n is even, n*(-1)^((n-1)/2) if n is odd.
a(n) = -a(n-2) if n is even, 2*a(n-1) - a(n-2) if n is odd. - Michael Somos, Jan 26 2014
From Henry Bottomley, Oct 19 2001: (Start)
a(n) = (n^n mod (n+1))*(-1)^floor(n/2) for n > 0.
a(n) = (-1)^n*(a(n-2) - a(n-1)) - a(n-3) for n > 2. (End)
G.f.: (1+x+x^2-x^3)/(1+x^2)^2.
E.g.f.: (1+x)*cos(x) = U(0) where U(k) = 1 + x - x^2/((2*k+1)*(2*k+2)) * U(k+1). - Sergei N. Gladkovskii, Oct 17 2012 [Edited by Michael Somos, Jan 26 2014]
From James C. McMahon, Oct 12 2023: (Start)
a(0) = 1; for n > 1,
a(n) = a(n-1) * n if n mod 4 = 1,
a(n-1) - n if n mod 4 = 2,
a(n-1) * n if n mod 4 = 3,
a(n-1) + n if n mod 4 = 4. (End)

Extensions

Formula corrected by Olivier Gérard, Mar 15 1997
Definition clarified by Harvey P. Dale, Jul 15 2012

A130195 Row sums of triangle A130194.

Original entry on oeis.org

1, 3, 2, -2, -1, 5, 4, -4, -3, 7, 6, -6, -5, 9, 8, -8, -7, 11, 10, -10, -9, 13, 12, -12, -11, 15, 14, -14, -13, 17, 16, -16, -15, 19, 18, -18, -17, 21, 20, -20, -19, 23, 22, -22, -21, 25, 24, -24, -23, 27, 26, -26, -25, 29, 28, -28, -27, 31, 30, -30, -29, 33
Offset: 1

Views

Author

Gary W. Adamson, May 16 2007

Keywords

Examples

			a(4) = -2 = sum of A130194 row 4 terms: (-4, -1, 2, 1).
		

Crossrefs

Programs

  • Mathematica
    LinearRecurrence[{1,-2,2,-1,1},{1,3,2,-2,-1},70] (* Harvey P. Dale, Jun 24 2023 *)
  • PARI
    lista(nn) = {vgf = x*(1+x)^2/(1+x^2)^2 + O(x^(nn+1)); m = matrix(nn, nn, i, j, if (i >= j, polcoeff(vgf, i-j+1))); for (n=1, nn, s = sum(k=1, n, m[n, k]); print1(s, ", "););} \\ Michel Marcus, Oct 03 2014
    
  • PARI
    Vec(-x*(x+1)^2/((x-1)*(x^2+1)^2) + O(x^100)) \\ Colin Barker, Oct 03 2014

Formula

Row sums of A130194, which is composed of A009531 in every column.
a(n) = a(n-1)-2*a(n-2)+2*a(n-3)-a(n-4)+a(n-5). - Colin Barker, Oct 03 2014
G.f.: -x*(x+1)^2/((x-1)*(x^2+1)^2). - Colin Barker, Oct 03 2014
a(n) = (4+(3+(2*n+1)*(-1)^n)*(-1)^((2*n-3-(-1)^n)/4))/4. - Luce ETIENNE, Aug 14 2015

Extensions

More terms from Michel Marcus, Oct 03 2014

A130194 Let M = lower triangular matrix with 1's on and below the main diagonal, with columns multiplied by +1, +1, -1, -1, repeated; form M^2; read across rows of resulting triangle.

Original entry on oeis.org

1, 2, 1, -1, 2, 1, -4, -1, 2, 1, 1, -4, -1, 2, 1, 6, 1, -4, -1, 2, 1, -1, 6, 1, -4, -1, 2, 1, -8, -1, 6, 1, -4, -1, 2, 1, 1, -8, -1, 6, 1, -4, -1, 2, 1, 10, 1, -8, -1, 6, 1, -4, -1, 2, 1, -1, 10, 1, -8, -1, 6, 1, -4, -1, 2, 1, -12, -1, 10, 1, -8, -1, 6, 1, -4, -1, 2, 1
Offset: 1

Views

Author

Gary W. Adamson, May 16 2007

Keywords

Comments

A000012(signed)^2.
Left border = A009531: (1, 2, -1, -4, 1, 6, -1, ...).
Row sums = A130195: (1, 3, 2, -2, -1, 5, 4, ...).
Row sums of the unsigned triangle = A058074: (1, 3, 4, 8, 9, 15, ...).
A009531 in every column: (1, 2, -1, -4, 1, 6, -1, ...).

Examples

			First few rows of the triangle:
   1;
   2,  1;
  -1,  2,  1;
  -4, -1,  2,  1;
   1, -4, -1,  2,  1;
   6,  1, -4, -1,  2,  1;
  ...
		

Crossrefs

Programs

  • PARI
    trg(nn) = {vgf = x*(1+x)^2/(1+x^2)^2 + O(x^(nn+1)); m = matrix(nn, nn, i, j, if (i >= j, polcoeff(vgf, i-j+1))); for (n=1, nn, for (k=1, n, print1(m[n, k], ", ");); print(););} \\ Michel Marcus, Oct 03 2014

Extensions

More terms from Michel Marcus, Oct 03 2014

A216972 a(4n+2) = 2, otherwise a(n) = n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 2, 7, 8, 9, 2, 11, 12, 13, 2, 15, 16, 17, 2, 19, 20, 21, 2, 23, 24, 25, 2, 27, 28, 29, 2, 31, 32, 33, 2, 35, 36, 37, 2, 39, 40, 41, 2, 43, 44, 45, 2, 47, 48, 49, 2, 51, 52, 53, 2, 55, 56, 57, 2, 59, 60, 61, 2, 63, 64, 65, 2, 67, 68, 69, 2
Offset: 0

Views

Author

Paul Curtz, Sep 21 2012

Keywords

Comments

For n>0, a(n) is the denominator of A214282(n)/(-A214283(n+1)):
1/1, 1/2, 1/3, 3/4, 3/5, 1/2, 3/7, 5/8, 5/9, ...
For n>0, a(n) is the denominator of A214283(n)/A214283(n+1):
0/1, 1/2, 2/3, 3/4, 2/5, 1/2, 4/7, 5/8, 4/9, ...
a(n), first and second differences:
0, 1, 2, 3, 4, 5, 2, 7, 8, 9, 2, 11, 12, ...
1, 1, 1, 1, 1, -3, 5, 1, 1, -7, 9, 1, 1, ...
0, 0, 0, 0, -4, 8, -4, 0, -8, 16, -8, 0, -12, ...

Crossrefs

Programs

  • Magma
    [n mod 4 eq 2 select 2 else n: n in [0..70]]; // Bruno Berselli, Sep 26 2012
    
  • Mathematica
    a[n_] := If[Mod[n, 4] == 2, 2, n]; Table[a[n], {n, 0, 81}] (* Jean-François Alcover, Sep 25 2012 *)
    LinearRecurrence[{0,0,0,2,0,0,0,-1},{0,1,2,3,4,5,2,7},80] (* Harvey P. Dale, Nov 06 2017 *)
  • Maxima
    makelist(expand(2+(4-(1+(-1)^n)*(1-%i^n))*(n-2)/4), n, 0, 70); /* Bruno Berselli, Sep 26 2012 */
    
  • Python
    def A216972(n): return 2 if n&3==2 else n # Chai Wah Wu, Jan 31 2024

Formula

a(n) = 2*a(n-4) - a(n-8).
a(n+4) - a(n) = 4*A152822(n).
a(2n) + a(2n+1) = |A141124(n)|.
a(4n) + a(4n+1) + a(4n+2) + a(4n+3) = 6*A005408(n) = A017593(n).
G.f.: (x+2*x^2+3*x^3+4*x^4+3*x^5-2*x^6+x^7) / (1-2*x^4+x^8). - Jean-François Alcover, Sep 25 2012
a(n) = 2+(4-(1+(-1)^n)*(1-i^n))*(n-2)/4, where i=sqrt(-1). - Bruno Berselli, Sep 26 2012
a(2n) = 2*|A009531(n)|, a(2n+1) = 2n+1. - Bruno Berselli, Sep 27 2012
Showing 1-10 of 10 results.