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

A153641 Nonzero coefficients of the Swiss-Knife polynomials for the computation of Euler, tangent, and Bernoulli numbers (triangle read by rows).

Original entry on oeis.org

1, 1, 1, -1, 1, -3, 1, -6, 5, 1, -10, 25, 1, -15, 75, -61, 1, -21, 175, -427, 1, -28, 350, -1708, 1385, 1, -36, 630, -5124, 12465, 1, -45, 1050, -12810, 62325, -50521, 1, -55, 1650, -28182, 228525, -555731, 1, -66, 2475, -56364, 685575, -3334386, 2702765, 1
Offset: 0

Views

Author

Peter Luschny, Dec 29 2008

Keywords

Comments

In the following the expression [n odd] is 1 if n is odd, 0 otherwise.
(+) W_n(0) = E_n are the Euler (or secant) numbers A122045.
(+) W_n(1) = T_n are the signed tangent numbers, see A009006.
(+) W_{n-1}(1) n / (4^n - 2^n) = B_n gives for n > 1 the Bernoulli number A027641/A027642.
(+) W_n(-1) 2^{-n}(n+1) = G_n the Genocchi number A036968.
(+) W_n(1/2) 2^{n} are the signed generalized Euler (Springer) number, see A001586.
(+) | W_n([n odd]) | the number of alternating permutations A000111.
(+) | W_n([n odd]) / n! | for 0<=n the Euler zeta number A099612/A099617 (see Wikipedia on Bernoulli number). - Peter Luschny, Dec 29 2008
The diagonals in the full triangle (with zero coefficients) of the polynomials have the general form E(k)*binomial(n+k,k) (k>=0 fixed, n=0,1,...) where E(n) are the Euler numbers in the enumeration A122045. For k=2 we find the triangular numbers A000217 and for k=4 A154286. - Peter Luschny, Jan 06 2009
From Peter Bala, Jun 10 2009: (Start)
The Swiss-Knife polynomials W_n(x) may be expressed in terms of the Bernoulli polynomials B(n,x) as
... W_n(x) = 4^(n+1)/(2*n+2)*[B(n+1,(x+3)/4) - B(n+1,(x+1)/4)].
The Swiss-Knife polynomials are, apart from a multiplying factor, examples of generalized Bernoulli polynomials.
Let X be the Dirichlet character modulus 4 defined by X(4*n+1) = 1, X(4*n+3) = -1 and X(2*n) = 0. The generalized Bernoulli polynomials B(X;n,x), n = 1,2,..., associated with the character X are defined by means of the generating function
... t*exp(x*t)*(exp(t)-exp(3*t))/(exp(4*t)-1) = sum {n = 1..inf} B(X;n,x)*t^n/n!.
The first few values are B(X;1,x) = -1/2, B(X;2,x) = -x, B(X,3,x) = -3/2*(x^2-1) and B(X;4,x) = -2*(x^3-3*x).
In general, W_n(x) = -2/(n+1)*B(X;n+1,x).
For the theory of generalized Bernoulli polynomials associated to a periodic arithmetical function see [Cohen, Section 9.4].
The generalized Bernoulli polynomials may be used to evaluate twisted sums of k-th powers. For the present case the result is
sum{n = 0..4*N-1} X(n)*n^k = 1^k - 3^k + 5^k - 7^k + ... - (4*N-1)^k
= [B(X;k+1,4*N) - B(X;k+1,0)]/(k+1) = [W_k(0) - W_k(4*N)]/2.
For the proof apply [Cohen, Corollary 9.4.17 with m = 4 and x = 0].
The generalized Bernoulli polynomials and the Swiss-Knife polynomials are also related to infinite sums of powers through their Fourier series - see the formula section below. For a table of the coefficients of generalized Bernoulli polynomials attached to a Dirichlet character modulus 8 see A151751.
(End)
The Swiss-Knife polynomials provide a general formula for alternating sums of powers similar to the formula which are provided by the Bernoulli polynomials for non-alternating sums of powers (see the Luschny link). Sequences covered by this formula include A001057, A062393, A062392, A011934, A144129, A077221, A137501, A046092. - Peter Luschny, Jul 12 2009
The greatest common divisor of the nonzero coefficients of the decapitated Swiss-Knife polynomials is exp(Lambda(n)), where Lambda(n) is the von Mangoldt function for odd primes, symbolically:
gcd(coeffs(SKP_{n}(x) - x^n)) = A155457(n) (n>1). - Peter Luschny, Dec 16 2009
Another version is at A119879. - Philippe Deléham, Oct 26 2013

Examples

			1
x
x^2  -1
x^3  -3x
x^4  -6x^2   +5
x^5 -10x^3  +25x
x^6 -15x^4  +75x^2  -61
x^7 -21x^5 +175x^3 -427x
		

References

  • H. Cohen, Number Theory - Volume II: Analytic and Modern Tools, Graduate Texts in Mathematics. Springer-Verlag. [From Peter Bala, Jun 10 2009]

Crossrefs

W_n(k), k=0,1,...
W_0: 1, 1, 1, 1, 1, 1, ........ A000012
W_1: 0, 1, 2, 3, 4, 5, ........ A001477
W_2: -1, 0, 3, 8, 15, 24, ........ A067998
W_3: 0, -2, 2, 18, 52, 110, ........ A121670
W_4: 5, 0, -3, 32, 165, 480, ........
W_n(k), n=0,1,...
k=0: 1, 0, -1, 0, 5, 0, -61, ... A122045
k=1: 1, 1, 0, -2, 0, 16, 0, ... A155585
k=2: 1, 2, 3, 2, -3, 2, 63, ... A119880
k=3: 1, 3, 8, 18, 32, 48, 128, ... A119881
k=4: 1, 4, 15, 52, 165, 484, ........ [Peter Luschny, Jul 07 2009]

Programs

  • Maple
    w := proc(n,x) local v,k,pow,chen; pow := (a,b) -> if a = 0 and b = 0 then 1 else a^b fi; chen := proc(m) if irem(m+1,4) = 0 then RETURN(0) fi; 1/((-1)^iquo(m+1,4) *2^iquo(m,2)) end; add(add((-1)^v*binomial(k,v)*pow(v+x+1,n)*chen(k),v=0..k), k=0..n) end:
    # Coefficients with zeros:
    seq(print(seq(coeff(i!*coeff(series(exp(x*t)*sech(t),t,16),t,i),x,i-n),n=0..i)), i=0..8);
    # Recursion
    W := proc(n,z) option remember; local k,p;
    if n = 0 then 1 else p := irem(n+1,2);
    z^n - p + add(`if`(irem(k,2)=1,0,
    W(k,0)*binomial(n,k)*(power(z,n-k)-p)),k=2..n-1) fi end:
    # Peter Luschny, edited and additions Jul 07 2009, May 13 2010, Oct 24 2011
  • Mathematica
    max = 9; rows = (Reverse[ CoefficientList[ #, x]] & ) /@ CoefficientList[ Series[ Exp[x*t]*Sech[t], {t, 0, max}], t]*Range[0, max]!; par[coefs_] := (p = Partition[ coefs, 2][[All, 1]]; If[ EvenQ[ Length[ coefs]], p, Append[ p, Last[ coefs]]]); Flatten[ par /@ rows] (* Jean-François Alcover, Oct 03 2011, after g.f. *)
    sk[n_, x_] := Sum[Binomial[n, k]*EulerE[k]*x^(n-k), {k, 0, n}]; Table[CoefficientList[sk[n, x], x] // Reverse // Select[#, # =!= 0 &] &, {n, 0, 13}] // Flatten (* Jean-François Alcover, May 21 2013 *)
    Flatten@Table[Binomial[n, 2k] EulerE[2k], {n, 0, 12}, {k, 0, n/2}](* Oliver Seipel, Jan 14 2025 *)
  • Sage
    def A046978(k):
        if k % 4 == 0:
            return 0
        return (-1)**(k // 4)
    def A153641_poly(n, x):
        return expand(add(2**(-(k // 2))*A046978(k+1)*add((-1)**v*binomial(k,v)*(v+x+1)**n for v in (0..k)) for k in (0..n)))
    for n in (0..7): print(A153641_poly(n, x))  # Peter Luschny, Oct 24 2011

Formula

W_n(x) = Sum_{k=0..n}{v=0..k} (-1)^v binomial(k,v)*c_k*(x+v+1)^n where c_k = frac((-1)^(floor(k/4))/2^(floor(k/2))) [4 not div k] (Iverson notation).
From Peter Bala, Jun 10 2009: (Start)
E.g.f.: 2*exp(x*t)*(exp(t)-exp(3*t))/(1-exp(4*t))= 1 + x*t + (x^2-1)*t^2/2! + (x^3-3*x)*t^3/3! + ....
W_n(x) = 1/(2*n+2)*Sum_{k=0..n+1} 1/(k+1)*Sum_{i=0..k} (-1)^i*binomial(k,i)*((x+4*i+3)^(n+1) - (x+4*i+1)^(n+1)).
Fourier series expansion for the generalized Bernoulli polynomials:
B(X;2*n,x) = (-1)^n*(2/Pi)^(2*n)*(2*n)! * {sin(Pi*x/2)/1^(2*n) - sin(3*Pi*x/2)/3^(2*n) + sin(5*Pi*x/2)/5^(2*n) - ...}, valid for 0 <= x <= 1 when n >= 1.
B(X;2*n+1,x) = (-1)^(n+1)*(2/Pi)^(2*n+1)*(2*n+1)! * {cos(Pi*x/2)/1^(2*n+1) - cos(3*Pi*x/2)/3^(2*n+1) + cos(5*Pi*x/2)/5^(2*n+1) - ...}, valid for 0 <= x <= 1 when n >= 1 and for 0 <= x < 1 when n = 0.
(End)
E.g.f.: exp(x*t) * sech(t). - Peter Luschny, Jul 07 2009
O.g.f. as a J-fraction: z/(1-x*z+z^2/(1-x*z+4*z^2/(1-x*z+9*z^2/(1-x*z+...)))) = z + x*z^2 + (x^2-1)*z^3 + (x^3-3*x)*z^4 + .... - Peter Bala, Mar 11 2012
Conjectural o.g.f.: Sum_{n >= 0} (1/2^((n-1)/2))*cos((n+1)*Pi/4)*( Sum_{k = 0..n} (-1)^k*binomial(n,k)/(1 - (k + x)*t) ) = 1 + x*t + (x^2 - 1)*t^2 + (x^3 - 3*x)*t^3 + ... (checked up to O(t^13)), which leads to W_n(x) = Sum_{k = 0..n} 1/2^((k - 1)/2)*cos((k + 1)*Pi/4)*( Sum_{j = 0..k} (-1)^j*binomial(k, j)*(j + x)^n ). - Peter Bala, Oct 03 2016

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

A123684 Alternate A016777(n) with A000027(n).

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, 91, 31, 94, 32, 97, 33, 100, 34, 103, 35, 106, 36
Offset: 1

Views

Author

Alford Arnold, Oct 11 2006

Keywords

Comments

a(n) is a diagonal of Table A123685.
The arithmetic average of the first n terms gives the positive integers repeated (A008619). - Philippe Deléham, Nov 20 2013
Images under the modified '3x-1' map: a(n) = n/2 if n is even, (3n-1)/2 if n is odd. (In this sequence, the numbers at even indices n are n/2 [A000027], and the numbers at odd indices n are 3((n-1)/2) + 1 [A016777] = (3n-1)/2.) The latter correspondence interestingly mirrors an insight in David Bařina's 2020 paper (see below), namely that 3(n+1)/2 - 1 = (3n+1)/2. - Kevin Ge, Oct 30 2024

Examples

			The natural numbers begin 1, 2, 3, ... (A000027), the sequence 3*n + 1 begins 1, 4, 7, 10, ... (A016777), therefore A123684 begins 1, 1, 4, 2, 7, 3, 10, ...
1/1 = 1, (1+1)/2 = 1, (1+1+4)/3 = 2, (1+1+4+2)/4 = 2, ... - _Philippe Deléham_, Nov 20 2013
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a123684 n = a123684_list !! (n-1)
    a123684_list = concat $ transpose [a016777_list, a000027_list]
    -- Reinhard Zumkeller, Apr 29 2013
    
  • Magma
    &cat[ [ 3*n-2, n ]: n in [1..36] ]; // Klaus Brockhaus, May 12 2007
    
  • Magma
    /* From the fourteenth formula: */ [&+[1+k*(-1)^k: k in [0..n]]: n in [0..80]]; // Bruno Berselli, Jul 16 2013
    
  • Maple
    A123684:=n->n-1/4-(1/2*n-1/4)*(-1)^n: seq(A123684(n), n=1..70); # Wesley Ivan Hurt, Jul 26 2014
  • Mathematica
    CoefficientList[Series[(1 +x +2*x^2)/((1-x)^2*(1+x)^2), {x,0,70}], x] (* Wesley Ivan Hurt, Jul 26 2014 *)
    LinearRecurrence[{0,2,0,-1},{1,1,4,2},80] (* Harvey P. Dale, Apr 14 2025 *)
  • PARI
    print(vector(72, n, if(n%2==0, n/2, (3*n-1)/2))) \\ Klaus Brockhaus, May 12 2007
    
  • PARI
    print(vector(72, n, n-1/4-(1/2*n-1/4)*(-1)^n)); \\ Klaus Brockhaus, May 12 2007
    
  • SageMath
    [(n + (2*n-1)*(n%2))//2 for n in range(1,71)] # G. C. Greubel, Mar 15 2024

Formula

From Klaus Brockhaus, May 12 2007: (Start)
G.f.: x*(1+x+2*x^2)/((1-x)^2*(1+x)^2).
a(n) = (1/4)*(4*n - 1 - (2*n - 1)*(-1)^n).
a(2n-1) = A016777(n-1) = 3(n-1) + 1.
a(2n) = A000027(n) = n.
a(n) = A071045(n-1) + 1.
a(n) = A093005(n) - A093005(n-1) for n > 1.
a(n) = A105638(n+2) - A105638(n+1) for n > 1.
a(n) = A092530(n) - A092530(n-1) - 1.
a(n) = A031878(n+1) - A031878(n) - 1. (End)
a(2*n+1) + a(2*n+2) = A016825(n). - Paul Curtz, Mar 09 2011
a(n)= 2*a(n-2) - a(n-4). - Paul Curtz, Mar 09 2011
From Jaroslav Krizek, Mar 22 2011 (Start):
a(n) = n + a(n-1) for odd n; a(n) = n - A064455(n-1) for even n.
a(n) = A064455(n) - A137501(n).
Abs(a(n) - A064455(n)) = A052928(n). (End)
a(n) = A225126(n) for n > 1. - Reinhard Zumkeller, Apr 29 2013
a(n) = Sum_{k=1..n} (1 + (k-1)*(-1)^(k-1)). - Bruno Berselli, Jul 16 2013
a(n) = n + floor(n/2) for odd n; a(n) = n/2 for even n. - Reinhard Muehlfeld, Jul 25 2014

Extensions

More terms from Klaus Brockhaus, May 12 2007

A273894 Table T(n,k), n >= 0, k = 1..2^n, read by rows, giving coefficients of iterations of polynomial x^2-x: see Comments for precise definition.

Original entry on oeis.org

1, -1, 1, 1, 0, -2, 1, -1, 1, 2, -5, 2, 4, -4, 1, 1, 0, -4, 2, 12, -14, -20, 48, -14, -50, 60, -10, -28, 24, -8, 1, -1, 1, 4, -10, -8, 54, -24, -180, 270, 270, -960, 150, 2064, -2040, -2352, 5871, -1566, -7236, 8880, 120, -9120, 7980, 120, -5340, 4212, -756
Offset: 0

Views

Author

Robert Israel, Jun 02 2016

Keywords

Comments

Let p(0) = t, p(n) = p(n-1)^2 - p(n-1) for i >= 1.
T(n,k) is coefficient of t^k in p(n).
Rows sum to 0, except for row 0. - David A. Corneth, Jun 02 2016

Examples

			Table starts:
   1;
  -1, 1;
   1, 0, -2,  1;
  -1, 1,  2, -5,  2,   4,  -4,  1;
   1, 0, -4,  2, 12, -14, -20, 48, -14, -50, 60, -10, -28, 24, -8, 1;
  ...
		

Crossrefs

Programs

  • Maple
    P[0]:= t:
    for n from 1 to 8 do
      P[n]:= expand(P[n-1]^2 - P[n-1])
    od:
    seq(seq(coeff(P[n],t,j),j=1..2^n),n=0..8);
  • Mathematica
    CoefficientList[NestList[Expand[#^2-#]&, x, 5]/x, x] // Flatten (* Jean-François Alcover, Apr 29 2019 *)

Formula

T(n,k) = -T(n-1,k) + Sum_{j=1..k-1} T(n-1,j) T(n-1,k-j).
Column k is of the form
T(n,k) = b_k(n) + (-1)^n*c_k(n)
where b_k and c_k seem to be polynomials of degree floor(k/2) - 1 and floor((k-1)/2) respectively (except b_1 = 0).
Leading coefficient of b_k(n) + (-1)^n*c_k(n) seems to be
-(-2)^(k/2-2) - binomial(-3/2,k/2-1)*2^(k/2-2)*(-1)^n if k is even,
2^((k-1)/2)*binomial(-1/2,(k-1)/2)*(-1)^n if k is odd.
T(n,1) = (-1)^n = A033999(n).
T(n,2) = 1/2 + (-1)^n/2 = A000035(n)
T(n,3) = -1/2 + (-n + 1/2)*(-1)^n = -A137501(n).
T(n,4) = -n + 5/4 + (3*n/2 - 5/4)*(-1)^n
= n/2 if n is even, -5*(n-1)/2 if n is odd.
T(n,5) = 2*n - 11/4 + (3*n^2/2 - 5*n + 11/4)*(-1)^n
= 12*A161680(n/2) if n is even, -2*A270710((n-3)/2) if n >= 3 is odd.
T(n, 2^n) = 1 = A000012(n). - David A. Corneth, Jun 02 2016

A316791 a(n) is the least prime p such that the second forward difference of three consecutive primes p, q and r is n = (p - 2q + r)/2.

Original entry on oeis.org

3, 5, 29, 503, 137, 109, 1063, 1931, 521, 7951, 1949, 1667, 5743, 2969, 1321, 15817, 9547, 28349, 45433, 20807, 15679, 113837, 43793, 19603, 40283, 25469, 40637, 156151, 79697, 34057, 282487, 134507, 552401, 770663, 31393, 188021, 480203, 461707, 281429, 1078241, 265619, 637937
Offset: 0

Views

Author

Keywords

Comments

Inspired by A295973.
Except for the first three primes {2, 3, 5}, all sfds are even.
The only other sfd which is not covered by this sequence is when the primes are {2, 3, 5} which results in an sfd of 1.
Except for an sfd of 0 or 1, all values of sfd occur infinitely often.
As an example, sfd=2 for p = 5, 11, 17, 19, 41, 43, 79, 83, 101, 107, 127, 163, ..., .

Examples

			a(0) = 3 since the three consecutive primes {3, 5, 7} have an sfd of 0;
a(1) = 5 since the three consecutive primes {5, 7, 11} have an sfd of 2;
a(2) = 29 since the three consecutive primes {29, 31, 37} have an sfd of 4;
a(3) = 503 since the three consecutive primes {503, 509, 521} have an sfd of 6;
a(4) = 137 since the three consecutive primes {137, 139, 149} have an sfd of 8; etc.
		

Crossrefs

Programs

  • Mathematica
    p = 2; q = 3; r = 5; t[_] := 0; While[p < 1100000, d = p - 2q + r; If[ t[d] == 0, t[d] = p]; p = q; q = r; r = NextPrime@ r]; Array[ t[2#] &, 42, 0]
  • PARI
    a(n) = my(p=2, q=3); while ((p - 2*q + nextprime(q+1))/2 != n, p=q; q=nextprime(q+1)); p; \\ Michel Marcus, Mar 08 2023

A316792 a(n) is the least prime p such that the second forward difference of three consecutive primes p, q and r is n = -(p - 2q + r)/2.

Original entry on oeis.org

3, 7, 23, 1531, 139, 113, 523, 1069, 887, 6397, 1129, 3137, 5351, 2971, 1327, 14107, 9973, 19333, 84871, 16141, 15683, 73189, 31907, 28229, 35617, 35677, 44293, 43331, 107377, 34061, 221327, 134513, 31397, 480209, 173359, 332317, 933073, 736279, 265621, 843911, 404851, 155921
Offset: 0

Views

Author

Keywords

Comments

Inspired by A295973.
Except for the first three primes {2, 3, 5}, all sfds are even.
The only other sfd which is not covered by this sequence is when the primes are {2, 3, 5} which results in an sfd of 1.
Except for an sfd of 0 or 1, all values of sfd occur infinitely often.
As an example, sfd = -2 for p = 7, 13, 31, 37, 61, 67, 73, 97, 103, 157, 193, 223, 271, 277, 307, ..., .

Examples

			a(0) = 3 since the three consecutive primes {3, 5, 7} have an sfd of 0;
a(1) = 7 since the three consecutive primes {7, 11, 13} have a sfd of -2;
a(2) = 23 since the three consecutive primes {23, 29, 31} have a sfd of -4;
a(3) = 1531 since the three consecutive primes {1531, 1543, 1549} have an sfd of -6;
a(4) =  since the three consecutive primes {} have an sfd of -8; etc.
		

Crossrefs

Programs

  • Mathematica
    p = 2; q = 3; r = 5; t[_] := 0; While[p < 1000000, d = p - 2q + r; If[ t[d] == 0, t[d] = p]; p = q; q = r; r = NextPrime@ r]; Array[ t[-2#] &, 42, 0]
  • PARI
    a(n) = my(p=2, q=3); while ((p - 2*q + nextprime(q+1))/2 != -n, p=q; q=nextprime(q+1)); p; \\ Michel Marcus, Mar 08 2023

A267314 Expansion of 2*x*(1 + 2*x - x^2)/((1 - x)*(1 + x^2)^2).

Original entry on oeis.org

0, 2, 6, 0, -8, 2, 14, 0, -16, 2, 22, 0, -24, 2, 30, 0, -32, 2, 38, 0, -40, 2, 46, 0, -48, 2, 54, 0, -56, 2, 62, 0, -64, 2, 70, 0, -72, 2, 78, 0, -80, 2, 86, 0, -88, 2, 94, 0, -96, 2, 102, 0, -104, 2, 110, 0, -112, 2, 118, 0, -120, 2, 126, 0, -128, 2, 134, 0, -136, 2, 142, 0
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 13 2016

Keywords

Examples

			a(0) = 0;
a(1) = 0 + 2 = 2;
a(2) = 0 + 2 + 4 = 6;
a(3) = 0 + 2 + 4 - 6 = 0;
a(4) = 0 + 2 + 4 - 6 - 8 = -8;
a(5) = 0 + 2 + 4 - 6 - 8 + 10 = 2;
a(6) = 0 + 2 + 4 - 6 - 8 + 10 + 12 = 14;
a(7) = 0 + 2 + 4 - 6 - 8 + 10 + 12 - 14 = 0;
a(8) = 0 + 2 + 4 - 6 - 8 + 10 + 12 - 14 - 16 = -16;
a(9) = 0 + 2 + 4 - 6 - 8 + 10 + 12 - 14 - 16 + 18 = 2, etc.
		

Crossrefs

Programs

  • Magma
    &cat [[-8*n,2,8*n+6,0]: n in [0..20]]; // Bruno Berselli, Jan 19 2016
  • Mathematica
    Table[Sum[(2k)*(-1)^((-sin((Pi k)/2)+cos((Pi k)/2)+1)/2), {k, 0, n}], {n, 0, 80}]
    CoefficientList[Series[2 x (x^2 - 2 x - 1) / ((x - 1) (x^2 + 1)^2), {x, 0, 100}], x] (* Vincenzo Librandi, Jan 13 2016 *)
    Table[1 - (-1)^(n (n + 1)/2) - (1 + (-1)^n) (-1)^(n/2) n, {n, 0, 80}] (* Bruno Berselli, Jan 19 2016 *)
  • PARI
    concat(0, Vec(2*x*(1+2*x-x^2)/((1-x)*(1+x^2)^2) + O(x^100))) \\ Michel Marcus, Jan 13 2016
    

Formula

G.f.: 2*x*(1 + 2*x - x^2)/((1 - x)*(1 + x^2)^2).
a(n) = Sum_{k = 0..n} (2k)*(-1)^((-sin((Pi*k)/2) + cos((Pi*k)/2) + 1)/2).
a(n) = Sum_{k = 0..n} A005843(k)*(-1)^A133872(k + 1).
a(n) = 1 - (-1)^(n*(n+1)/2) - (1+(-1)^n)*(-1)^(n/2)*n. [Bruno Berselli, Jan 19 2016]
Showing 1-7 of 7 results.