login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A022998 If n is odd then n, otherwise 2n. 87
0, 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, 65, 132, 67 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
Also for n > 0: numerator of Sum_{i=1..n} 2/(i*(i+1)), denominator=A026741. - Reinhard Zumkeller, Jul 25 2002
For n > 2: a(n) = gcd(A143051((n-1)^2), A143051(1+(n-1)^2)) = A050873(A000290(n-1), A002522(n-1)). - Reinhard Zumkeller, Jul 20 2008
Partial sums give the generalized octagonal numbers A001082. - Omar E. Pol, Sep 10 2011
Multiples of 4 and odd numbers interleaved. - Omar E. Pol, Sep 25 2011
The Pisano period lengths modulo m appear to be A066043(m). - R. J. Mathar, Oct 08 2011
The partial sums a(n)/A026741(n+1) given by R. Zumkeller in a comment above are 2*n/(n+1) (telescopic sum), and thus converge to 2. - Wolfdieter Lang, Apr 09 2013
a(n) = numerator(H(n,1)), where H(n,1) = 2*n/(n+1) is the harmonic mean of 1 and n. a(n) = 2*n/gcd(2n, n+1) = 2*n/gcd(n+1,2). a(n) = A227041(n,1), n>=1. - Wolfdieter Lang, Jul 04 2013
a(n) = numerator of the mean (2n/(n+1), after reduction), of the compositions of n; denominator is given by A001792(n-1). - Clark Kimberling, Mar 11 2014
A strong divisibility sequence, that is, gcd(a(n), a(m)) = a(gcd(n,m)) for all natural numbers n and m. The sequence of convergents of the 2-periodic continued fraction [0; 1, -4, 1, -4, ...] = 1/(1 - 1/(4 - 1/(1 - 1/(4 - ...)))) begins [0/1, 1/1, 4/3, 3/2, 8/5, 5/3, 12/7, ...]. The present sequence is the sequence of numerators. The sequence of denominators of the continued fraction convergents [1, 1, 3, 2, 5, 3, 7, ...] is A026741, also a strong divisibility sequence. Cf. A203976. - Peter Bala, May 19 2014
a(n) is also the length of the n-th line segment of a rectangular spiral on the infinite square grid. The vertices of the spiral are the generalized octagonal numbers. - Omar E. Pol, Jul 27 2018
a(n) is the number of petals of the Rhodonea curve r = a*cos(n*theta) or r = a*sin(n*theta). - Matt Westwood, Nov 19 2019
LINKS
Eric Weisstein's World of Mathematics, Rose
FORMULA
Denominator of (n+1)*(n-1)*(2*n+1)/(2*n) (for n > 0).
a(n+1) = lcm(n, n+2)/n + lcm(n, n+2)/(n+2) for all n >= 1. - Asher Auel, Dec 15 2000
Multiplicative with a(2^e) = 2^(e+1), a(p^e) = p^e, p > 2.
G.f. x*(1 + 4*x + x^2)/(1-x^2)^2. - Ralf Stephan, Jun 10 2003
a(n) = 3*n/2 + n*(-1)^n/2 = n*(3 + (-1)^n)/2. - Paul Barry, Sep 04 2003
a(n) = A059029(n-1) + 1 = A043547(n+2) - 2.
a(n)*a(n+3) = -4 + a(n+1)*a(n+2).
a(n) = n*(((n+1) mod 2) + 1) = n^2 + 2*n - 2*n*floor((n+1)/2). - William A. Tedeschi, Feb 29 2008
a(n) = denominator((n+1)/(2*n)) for n >= 1; A026741(n+1) = numerator((n+1)/(2*n)) for n >= 1. - Johannes W. Meijer, Jun 18 2009
a(n) = 2*a(n-2) - a(n-4).
Dirichlet g.f. zeta(s-1)*(1+2^(1-s)). - R. J. Mathar, Mar 10 2011
a(n) = n * (2 - n mod 2) = n * A000034(n+1). - Reinhard Zumkeller, Mar 31 2012
a(n) = floor(2*n/(1 + (n mod 2))). - Wesley Ivan Hurt, Dec 13 2013
From Ilya Gutkovskiy, Mar 16 2017: (Start)
E.g.f.: x*(2*sinh(x) + cosh(x)).
It appears that a(n) is the period of the sequence k*(k + 1)/2 mod n. (End)
a(n) = Sum_{d | n} A345082(d). - Peter Bala, Jan 13 2024
MAPLE
A022998 := proc(n) if type(n, 'odd') then n ; else 2*n; end if; end proc: # R. J. Mathar, Mar 10 2011
MATHEMATICA
Table[n (3 + (-1)^n)/2, {n, 0, 100}] (* Wesley Ivan Hurt, Dec 13 2013 *)
Table[If[OddQ[n], n, 2n], {n, 0, 150}] (* or *) Riffle[ 2*Range[ 0, 150, 2], Range[ 1, 150, 2]] (* Harvey P. Dale, Feb 06 2017 *)
PROG
(PARI) a(n)=if(n%2, n, 2*n)
(Magma) [((-1)^n+3)*n/2: n in [0..70]]; // Vincenzo Librandi, Sep 17 2011
(Haskell)
a022998 n = a000034 (n + 1) * n
a022998_list = zipWith (*) [0..] $ tail a000034_list
-- Reinhard Zumkeller, Mar 31 2012
(SageMath) [n*(1+((n+1)%2)) for n in (0..80)] # G. C. Greubel, Jul 31 2022
(Python)
def A022998(n): return n if n&1 else n<<1 # Chai Wah Wu, Mar 05 2024
CROSSREFS
Column 4 of A195151. - Omar E. Pol, Sep 25 2011
Cf. A000034, A001082 (partial sums).
Cf. A227041 (first column). - Wolfdieter Lang, Jul 04 2013
Sequence in context: A263616 A280166 A257088 * A082895 A086938 A007015
KEYWORD
nonn,easy,mult
AUTHOR
EXTENSIONS
More terms from Michael Somos, Aug 07 2000
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 04:55 EDT 2024. Contains 371235 sequences. (Running on oeis4.)