login
a(n) = n if n is even, 2*n + 1 if n is odd.
9

%I #39 Feb 19 2024 10:29:38

%S 0,3,2,7,4,11,6,15,8,19,10,23,12,27,14,31,16,35,18,39,20,43,22,47,24,

%T 51,26,55,28,59,30,63,32,67,34,71,36,75,38,79,40,83,42,87,44,91,46,95,

%U 48,99,50,103,52,107,54,111,56,115,58,119,60,123,62,127,64,131,66,135

%N a(n) = n if n is even, 2*n + 1 if n is odd.

%C a(n-1) = n^k - 1 mod 2*n, n >= 1, for any k >= 2, also for k = n. - _Wolfdieter Lang_, Dec 21 2011

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

%H <a href="/index/Tu#2wis">Index entries for two-way infinite sequences</a>

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

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

%F Third main diagonal of A059026: a(n) = B(n+2, n) = lcm(n+2, n)/(n+2) + lcm(n+2, n)/n - 1 for all n >= 1.

%F a(2*n) + a(2*n+1) = A016945(n). - _Paul Curtz_, Aug 29 2008

%F E.g.f.: 2*x*cosh(x) + (1 + x)*sinh(x). - _Franck Maminirina Ramaharo_, Nov 08 2018

%p B := (n,m) -> lcm(n,m)/n + lcm(n,m)/m - 1: seq(B(m+2,m),m=1..90);

%t Table[n +(n+1)*(1-(-1)^n)/2, {n,0,70}] (* _G. C. Greubel_, Nov 08 2018 *)

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

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

%Y Cf. A059026, A059030, A059031.

%Y a(n) = A022998(n+1) - 1 = A043547(n+3) - 3. Partial sums in A032438.

%K nonn,easy

%O 0,2

%A _Asher Auel_, Dec 15 2000

%E New description from _Ralf Stephan_, Jun 10 2003