A047471 Numbers that are congruent to {1, 3} mod 8.
1, 3, 9, 11, 17, 19, 25, 27, 33, 35, 41, 43, 49, 51, 57, 59, 65, 67, 73, 75, 81, 83, 89, 91, 97, 99, 105, 107, 113, 115, 121, 123, 129, 131, 137, 139, 145, 147, 153, 155, 161, 163, 169, 171, 177, 179, 185, 187, 193, 195, 201, 203, 209, 211, 217, 219, 225, 227, 233
Offset: 1
Examples
For n=2, a(2) = 8*2-1-12 = 3; For n=3, a(3) = 8*3-3-12 = 9; For n=4, a(4) = 8*4-9-12 = 11. - _Vincenzo Librandi_, Aug 06 2010
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
Programs
-
Haskell
a047471 n = a047471_list !! (n-1) a047471_list = [n | n <- [1..], mod n 8 `elem` [1,3]] -- Reinhard Zumkeller, Dec 29 2012
-
Magma
[4*(n-1)-(-1)^n : n in [1..80]]; // Wesley Ivan Hurt, Apr 28 2017
-
Maple
A047471:=n->4*n - 4 - (-1)^n; seq(A047471(n), n=1..100); # Wesley Ivan Hurt, Jan 30 2014
-
Mathematica
Table[4 n - 4 - (-1)^n, {n, 100}] (* Wesley Ivan Hurt, Jan 30 2014 *) #+{1,3}&/@(8*Range[0,30])//Flatten (* or *) LinearRecurrence[{1,1,-1},{1,3,9},60] (* Harvey P. Dale, Jan 05 2017 *)
Formula
G.f.: x*(1+2*x+5*x^2)/((1+x)*(1-x)^2). - Paul Barry, Apr 10 2008
a(n) = 4*(n-1)-(-1)^n. - Rolf Pleisch, Aug 04 2009
a(n) = 8*n-a(n-1)-12, with a(1)=1. - Vincenzo Librandi, Aug 06 2010
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/8 + sqrt(2)*log(sqrt(2)+1)/4. - Amiram Eldar, Dec 18 2021
Extensions
More terms from Vincenzo Librandi, Aug 06 2010