%I #20 Jan 08 2018 01:47:44
%S 2,4,6,8,12,14,20,22,30,32,42,44,56,58,72,74,90,92,110,112,132,134,
%T 156,158,182,184,210,212,240,242,272,274,306,308,342,344,380,382,420,
%U 422,462,464,506,508,552,554,600,602,650,652,702,704,756,758,812,814,870,872,930,932,992,994,1056,1058,1122,1124,1190,1192,1260,1262,1332,1334,1406,1408,1482,1484,1560,1562
%N Indices of occurrences of 2 in A004738.
%C Indices of occurrences of 1 in A004738 are given by A002061, b(n) = n^2 - n + 1 (the central polygonal numbers). All entries are even.
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,2,-2,-1,1).
%F G.f.: 2*x*(1+x-x^2-x^3+x^4)/((1+x)^2*(1-x)^3). - _Charles R Greathouse IV_, Feb 03 2013
%F a(n) = 2*A134519(n). - _R. J. Mathar_, Feb 03 2013
%p A004738 := proc(n)
%p local f ;
%p f := floor(sqrt(n)+1/2) ;
%p f+1-abs(n-1-f^2) ;
%p end proc:
%p for n from 1 to 1600 do
%p if A004738(n) = 2 then
%p printf("%d,",n) ;
%p end if;
%p end do: # _R. J. Mathar_, Feb 03 2013
%t LinearRecurrence[{1,2,-2,-1,1},{2,4,6,8,12},80] (* _Harvey P. Dale_, Jun 16 2017 *)
%o (PARI) a(n)=(n^2+2*n+8+if(n%2,2*n-5))/4 \\ _Charles R Greathouse IV_, Feb 03 2013
%Y Cf. A004738.
%K nonn,easy
%O 1,1
%A _Amarnath Murthy_, Apr 15 2003
%E More terms from _R. J. Mathar_, Feb 03 2013
|