%I #25 Jan 01 2025 00:15:50
%S 2,4,3,5,4,6,5,7,6,8,7,9,8,10,9,11,10,12,11,13,12,14,13,15,14,16,15,
%T 17,16,18,17,19,18,20,19,21,20,22,21,23,22,24,23,25,24,26,25,27,26,28,
%U 27,29,28,30,29,31,30,32,31,33,32,34,33,35,34,36,35,37,36,38,37,39,38,40
%N Number of conjugacy classes (the same as the number of irreducible representations) in the dihedral group with 2n elements.
%D Jean-Pierre Serre, Linear Representations of Finite Groups, Springer-Verlag Graduate Texts in Mathematics 42.
%H Harry J. Smith, <a href="/A060762/b060762.txt">Table of n, a(n) for n=1,...,1000</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1, 1, -1).
%F For odd n: a(n) = (n+3)/2; for even n: a(n) = (n+6)/2.
%F a(1)=2,a(2)=4. For odd n:a(n)=(a(n-1)+a(n-2))/2; for even n: a(n)=(a(n-1)+a(n-2)+3)/2. - _Vincenzo Librandi_, Dec 20 2010
%F From _Colin Barker_, Apr 19 2012: (Start)
%F a(n) = a(n-1) + a(n-2) - a(n-3).
%F G.f.: x*(2 + 2*x - 3*x^2)/((1 - x)^2*(1 + x)). (End)
%t a[1] = 2; a[2] = 4; a[n_] := a[n] = (a[n - 1] + a[n - 2] + If[ OddQ@ n, 0, 3])/2; Array[a, 74]
%t LinearRecurrence[{1, 1, -1}, {2, 4, 3}, 74] (* _Robert G. Wilson v_, Apr 19 2012 *)
%o (Magma) [ IsOdd(n) select (n+3)/2 else n/2+3 : n in [1..10] ]; // Sergei Haller (sergei(AT)sergei-haller.de), Dec 21 2006
%o (PARI) a(n) = { if (n%2, (n + 3)/2, (n + 6)/2) } \\ _Harry J. Smith_, Jul 11 2009
%K nonn,easy
%O 1,1
%A Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 23 2001
%E More terms from _Jonathan Vos Post_, May 27 2007