login
a(n) = gcd(2n, n(n+1)/2).
3

%I #28 Apr 02 2022 18:28:21

%S 1,1,6,2,5,3,14,4,9,5,22,6,13,7,30,8,17,9,38,10,21,11,46,12,25,13,54,

%T 14,29,15,62,16,33,17,70,18,37,19,78,20,41,21,86,22,45,23,94,24,49,25,

%U 102,26,53,27,110,28,57,29,118,30,61,31,126,32,65,33,134,34,69,35,142

%N a(n) = gcd(2n, n(n+1)/2).

%C Same as A123168 (without the initial 0) interleaved with the natural numbers. - _Wesley Ivan Hurt_, Apr 01 2022

%H Charles R Greathouse IV, <a href="/A062828/b062828.txt">Table of n, a(n) for n = 1..10000</a>

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

%F a(4n+1) = 4n+1, a(4n+2) = 2n+1, a(4n+3) = 8n+6, a(4n+4) = 2n+2. - _Ralf Stephan_, Jun 10 2005

%F G.f.: x*(1 + x + 6*x^2 + 2*x^3 + 3*x^4 + x^5 + 2*x^6) / ( (x-1)^2*(1+x)^2*(x^2+1)^2 ). - _R. J. Mathar_, Jul 25 2013

%F From _Wesley Ivan Hurt_, Apr 01 2022: (Start)

%F a(n) = n*(2-(-1)^n-sin(n*Pi/2))/2.

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

%p A062828 := proc(n)

%p igcd(2*n,n*(n+1)/2) ;

%p end proc: # _R. J. Mathar_, Jul 25 2013

%t Table[GCD[2n,(n(n+1))/2],{n,120}] (* or *) LinearRecurrence[ {0,0,0,2,0,0,0,-1},{1,1,6,2,5,3,14,4},120] (* _Harvey P. Dale_, Apr 09 2018 *)

%o (PARI) j=[]; for(n=1,150,j=concat(j,gcd(2*n,n*(n+1)/2))); j

%o (PARI) a(n)=if(n%2,n*if(n%4>2,2,1),n/2) \\ _Charles R Greathouse IV_, Jul 07 2013

%Y Cf. A123168.

%K easy,nonn

%O 1,3

%A _Jason Earls_, Jul 20 2001