A257088 a(2*n) = 4*n if n>0, a(2*n + 1) = 2*n + 1, a(0) = 1.
1, 1, 4, 3, 8, 5, 12, 7, 16, 9, 20, 11, 24, 13, 28, 15, 32, 17, 36, 19, 40, 21, 44, 23, 48, 25, 52, 27, 56, 29, 60, 31, 64, 33, 68, 35, 72, 37, 76, 39, 80, 41, 84, 43, 88, 45, 92, 47, 96, 49, 100, 51, 104, 53, 108, 55, 112, 57, 116, 59, 120, 61, 124, 63, 128
Offset: 0
Examples
G.f. = 1 + x + 4*x^2 + 3*x^3 + 8*x^4 + 5*x^5 + 12*x^6 + 7*x^7 + 16*x^8 + ...
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
Crossrefs
Programs
-
Haskell
import Data.List (transpose) a257088 n = a257088_list !! n a257088_list = concat $ transpose [a008574_list, a005408_list] -- Reinhard Zumkeller, Apr 17 2015
-
Mathematica
a[ n_] := Which[ n < 1, Boole[n == 0], OddQ[n], n, True, 2 n]; a[ n_] := SeriesCoefficient[ (1 + x + 2*x^2 + x^3 + x^4) / (1 - 2*x^2 + x^4), {x, 0, n}];
-
PARI
{a(n) = if( n<1, n==0, n%2, n, 2*n)};
-
PARI
{a(n) = if( n<0, 0, polcoeff( (1 + x + 2*x^2 + x^3 + x^4) / (1 - 2*x^2 + x^4) + x * O(x^n), n))};
Formula
Euler transform of length 4 sequence [ 1, 3, -1, -1].
a(n) is multiplicative with a(2^e) = 2^(e+1) if e>0, otherwise a(p^e) = p^e.
G.f.: (1 + x + 2*x^2 + x^3 + x^4) / (1 - 2*x^2 + x^4).
G.f.: (1 - x^3) * (1 - x^4) / ((1 - x) * (1 - x^2)^3).
MOBIUS transform of A215947 is [1, 4, 3, 8, 5, ...].
a(n) = n * A040001(n) if n>0.
a(n) + a(n-1) = A007310(n) if n>0.
Binomial transform with a(0)=0 is A128543 if n>0.
a(n) = A022998(n) if n>0. - R. J. Mathar, Apr 19 2015
From Amiram Eldar, Jan 28 2025: (Start)
Dirichlet g.f.: (1+2^(1-s)) * zeta(s-1).
Sum_{k=1..n} a(k) ~ (3/4) * n^2. (End)
a(n) = gcd(n^n, 2*n). - Mia Boudreau, Jun 27 2025