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.

A257174 a(n) = 4*n/3 if n = 3*k and n!=0, otherwise a(n) = n except a(0) = 1.

Original entry on oeis.org

1, 1, 2, 4, 4, 5, 8, 7, 8, 12, 10, 11, 16, 13, 14, 20, 16, 17, 24, 19, 20, 28, 22, 23, 32, 25, 26, 36, 28, 29, 40, 31, 32, 44, 34, 35, 48, 37, 38, 52, 40, 41, 56, 43, 44, 60, 46, 47, 64, 49, 50, 68, 52, 53, 72, 55, 56, 76, 58, 59, 80, 61, 62, 84, 64, 65, 88
Offset: 0

Views

Author

Michael Somos, Apr 17 2015

Keywords

Examples

			G.f. = 1 + x + 2*x^2 + 4*x^3 + 4*x^4 + 5*x^5 + 8*x^6 + 7*x^7 + 8*x^8 + ...
		

References

  • This is a divisibility sequence.

Crossrefs

Programs

  • Magma
    I:=[1,1,2,4,4,5,8]; [n le 7 select I[n] else 2*Self(n-3)-Self(n-6): n in [1..80]]; // Vincenzo Librandi, Apr 28 2015
    
  • Magma
    m:=60; R:=PowerSeriesRing(Integers(), m); [0] cat Coefficients(R!((1+x^2)*(1+x+x^2+x^3+x^4)/(1-2*x^3+x^6))); // G. C. Greubel, Aug 02 2018
  • Maple
    A257174:=n->`if`(n=0,1,(n/3)*(4+floor(n/3)-ceil(n/3))): seq(A257174(n), n=0..100); # Wesley Ivan Hurt, Apr 27 2015
  • Mathematica
    a[ n_] := If[ n==0, 1, n + If[ Mod[n, 3] == 0, n/3, 0]];
    a[ n_] := n + Which[ n==0, 1, Mod[n, 3] == 0, n/3, True, 0];
    Join[{1}, LinearRecurrence[{0, 0, 2, 0, 0, -1}, {1, 2, 4, 4, 5, 8}, 100]] (* Vincenzo Librandi, Apr 28 2015 *)
    a[ n_] := If[ n==0, 1, Sign[n] SeriesCoefficient[ x / (1 - x)^2 + x^3 / (1 - x^3)^2, {x, 0, Abs@n}]]; (* Michael Somos, Dec 30 2016 *)
    CoefficientList[Series[(1+x^2)*(1+x+x^2+x^3+x^4)/(1-2*x^3+x^6), {x, 0, 60}], x] (* G. C. Greubel, Aug 02 2018 *)
  • PARI
    {a(n) = n + if( n==0, 1, n%3==0, n/3, 0)};
    
  • PARI
    {a(n) = if( n==0, 1, sign(n) * polcoeff( (1 - x^4) * (1 - x^5) / ((1 - x) * (1 - x^2) * (1 - x^3)^2) + x * O(x^abs(n)), abs(n)))};
    
  • PARI
    my(x='x+O('x^60)); Vec((1+x^2)*(1+x+x^2+x^3+x^4)/(1-2*x^3+x^6)) \\ G. C. Greubel, Aug 02 2018
    

Formula

Euler transform of length 5 sequence [1, 1, 2, -1, -1].
a(n) is multiplicative with a(0) = 1, a(3^e) = 4*3^(e-1) if e>0, a(p^e) = p^e otherwise.
G.f.: (1 - x^4) * (1 - x^5) / ((1 - x) * (1 - x^2) * (1 - x^3)^2).
G.f.: (1 + x^2) * (1 + x + x^2 + x^3 + x^4) / (1 - 2*x^3 + x^6).
a(3*n) = A008574(n).
a(n) = -a(-n) for all n in Z except n=0.
From Wesley Ivan Hurt, Apr 27 2015: (Start)
a(n) = 2*a(n-3)-a(n-6).
a(n) = n*(4+floor(n/3)+floor(-n/3))/3 for n>0. (End)
a(n) = (-1)^n * A280057(n). - Michael Somos, Dec 30 2016
G.f.: 1 + x / (1 - x)^2 + x^3 / (1 - x^3)^2. - Michael Somos, Dec 30 2016
0 = +22 + a(n)*(+21 + 3*a(n) + 7*a(n+1) -14*a(n+2)) + a(n+1)*(-6*a(n+1) + 7*a(n+2)) + a(n+2)*(-21 + 3*a(n+2)) if n>0. - Michael Somos, Dec 30 2016
Dirichlet g.f.: zeta(s-1)*(1+1/3^s). - Amiram Eldar, Dec 29 2022