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

%I #116 Mar 05 2024 16:15:05

%S 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,

%T 25,52,27,56,29,60,31,64,33,68,35,72,37,76,39,80,41,84,43,88,45,92,47,

%U 96,49,100,51,104,53,108,55,112,57,116,59,120,61,124,63,128,65,132,67

%N If n is odd then n, otherwise 2n.

%C Also for n > 0: numerator of Sum_{i=1..n} 2/(i*(i+1)), denominator=A026741. - _Reinhard Zumkeller_, Jul 25 2002

%C 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

%C Partial sums give the generalized octagonal numbers A001082. - _Omar E. Pol_, Sep 10 2011

%C Multiples of 4 and odd numbers interleaved. - _Omar E. Pol_, Sep 25 2011

%C The Pisano period lengths modulo m appear to be A066043(m). - _R. J. Mathar_, Oct 08 2011

%C 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

%C 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

%C 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

%C 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

%C 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

%C 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

%H Vincenzo Librandi, <a href="/A022998/b022998.txt">Table of n, a(n) for n = 0..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Rose.html">Rose</a>

%H <a href="/index/Di#divseq">Index to divisibility sequences</a>

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (0,2,0,-1).

%F Denominator of (n+1)*(n-1)*(2*n+1)/(2*n) (for n > 0).

%F a(n+1) = lcm(n, n+2)/n + lcm(n, n+2)/(n+2) for all n >= 1. - _Asher Auel_, Dec 15 2000

%F Multiplicative with a(2^e) = 2^(e+1), a(p^e) = p^e, p > 2.

%F G.f. x*(1 + 4*x + x^2)/(1-x^2)^2. - _Ralf Stephan_, Jun 10 2003

%F a(n) = 3*n/2 + n*(-1)^n/2 = n*(3 + (-1)^n)/2. - _Paul Barry_, Sep 04 2003

%F a(n) = A059029(n-1) + 1 = A043547(n+2) - 2.

%F a(n)*a(n+3) = -4 + a(n+1)*a(n+2).

%F a(n) = n*(((n+1) mod 2) + 1) = n^2 + 2*n - 2*n*floor((n+1)/2). - _William A. Tedeschi_, Feb 29 2008

%F 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

%F a(n) = 2*a(n-2) - a(n-4).

%F Dirichlet g.f. zeta(s-1)*(1+2^(1-s)). - _R. J. Mathar_, Mar 10 2011

%F a(n) = n * (2 - n mod 2) = n * A000034(n+1). - _Reinhard Zumkeller_, Mar 31 2012

%F a(n) = floor(2*n/(1 + (n mod 2))). - _Wesley Ivan Hurt_, Dec 13 2013

%F From _Ilya Gutkovskiy_, Mar 16 2017: (Start)

%F E.g.f.: x*(2*sinh(x) + cosh(x)).

%F It appears that a(n) is the period of the sequence k*(k + 1)/2 mod n. (End)

%F a(n) = Sum_{d | n} A345082(d). - _Peter Bala_, Jan 13 2024

%p A022998 := proc(n) if type(n,'odd') then n ; else 2*n; end if; end proc: # _R. J. Mathar_, Mar 10 2011

%t Table[n (3 + (-1)^n)/2, {n, 0, 100}] (* _Wesley Ivan Hurt_, Dec 13 2013 *)

%t 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 *)

%o (PARI) a(n)=if(n%2,n,2*n)

%o (Magma) [((-1)^n+3)*n/2: n in [0..70]]; // _Vincenzo Librandi_, Sep 17 2011

%o (Haskell)

%o a022998 n = a000034 (n + 1) * n

%o a022998_list = zipWith (*) [0..] $ tail a000034_list

%o -- _Reinhard Zumkeller_, Mar 31 2012

%o (SageMath) [n*(1+((n+1)%2)) for n in (0..80)] # _G. C. Greubel_, Jul 31 2022

%o (Python)

%o def A022998(n): return n if n&1 else n<<1 # _Chai Wah Wu_, Mar 05 2024

%Y Cf. A026741, A059026, A203976, A345082.

%Y Column 4 of A195151. - _Omar E. Pol_, Sep 25 2011

%Y Cf. A000034, A001082 (partial sums).

%Y Cf. A227041 (first column). - _Wolfdieter Lang_, Jul 04 2013

%K nonn,easy,mult

%O 0,3

%A _N. J. A. Sloane_

%E More terms from _Michael Somos_, Aug 07 2000

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 April 25 08:27 EDT 2024. Contains 371964 sequences. (Running on oeis4.)