OFFSET
1,1
COMMENTS
For n > 2, a(n) is the decimal value that results from the conversion of n-1 to binary whose last two bits are altered by either of the following rules: 00->010, 01->011, 10->100, 11->101. For example a(10) = 19 because 10 - 1 = 9 = '10'01'->'10'011' = 19. - Franck Maminirina Ramaharo, Jul 25 2018
LINKS
Bruno Berselli, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
G.f.: x*(2+x+x^2+x^3+3*x^4)/((1+x)*(1-x)^2*(1+x^2)). [Bruno Berselli, Jul 17 2012]
a(n) = 2*n-1-i^(n*(n+1))-(1+(-1)^n)/2, where i=sqrt(-1). [Bruno Berselli, Jul 17 2012]
a(n) = 2n - A010873(n-1). - Wesley Ivan Hurt, Jul 07 2013
From Wesley Ivan Hurt, Jun 01 2016: (Start)
a(n) = a(n-1) + a(n-4) - a(n-5) for n>5.
E.g.f.: 3 + sin(x) - cos(x) + (2*x - 1)*sinh(x) + 2*(x - 1)*cosh(x). - Ilya Gutkovskiy, Jun 02 2016
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/16 - (sqrt(2)+3)*log(2)/8 + sqrt(2)*log(sqrt(2)+2)/4. - Amiram Eldar, Dec 25 2021
MAPLE
A047596:=n->2*n-1-I^(n*(n+1))-(1+I^(2*n))/2: seq(A047596(n), n=1..100); # Wesley Ivan Hurt, Jun 01 2016
MATHEMATICA
Select[Range[120], MemberQ[{2, 3, 4, 5}, Mod[#, 8]] &] (* or *) LinearRecurrence[{1, 0, 0, 1, -1}, {2, 3, 4, 5, 10}, 60] (* Bruno Berselli, Jul 17 2012 *)
PROG
(Magma) [n: n in [1..120] | n mod 8 in [2..5]]; // Bruno Berselli, Jul 17 2012
(Maxima) makelist(2*n-1-%i^(n*(n+1))-(1+(-1)^n)/2, n, 1, 60); /* Bruno Berselli, Jul 17 2012 */
(PARI) Vec((2+x+x^2+x^3+3*x^4)/((1+x)*(1-x)^2*(1+x^2))+O(x^60)) \\ Bruno Berselli, Jul 17 2012
(GAP) Filtered([1..130], n->n mod 8=2 or n mod 8=3 or n mod 8=4 or n mod 8=5); # Muniru A Asiru, Jul 27 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved