OFFSET
1,2
COMMENTS
Also the set of nonnegative integers expressible as (x + 2y)(2x + y) for integer x and y, where integers of the form 3k + 2 are given by x = 2k + 1, y = -k, and integers of the form 9k are given by x = 2k - 1, y = 2 - k. - Drake Thomas, Nov 10 2022
From Klaus Purath, Feb 21 2023: (Start)
The sum of digits of any term belongs to the sequence. Also the products of an odd number of terms as well as products of one term each of this sequence and one term of A056991 are members. The products of an even number of terms belong to A056991.
Nonnegative integers of the forms 2*x^2 + (2*m+1)*x*y + ((m^2+m-2)/2)*y^2, for integers m. This includes the formula given by Drake Thomas above.
The union of this sequence and A056991 is closed under multiplication. (End)
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
a(n) = 3*(n-floor(n/4)) - (3 - i^n - (-i)^n - (-1)^n)/4 where i=sqrt(-1), offset=0.
From Wesley Ivan Hurt, Jun 07 2016: (Start)
G.f.: x^2*(2 + 3*x + 3*x^2 + x^3)/((x-1)^2*(1 + x + x^2 + x^3)).
a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5.
a(n) = (18*n - 15 + i^(2*n) + (3-i)*i^(-n) + (3+i)*i^n)/8 where i=sqrt(-1). (End)
MAPLE
seq(3*(n-floor(n/4))-(3-I^n-(-I)^n-(-1)^n)/4, n=0..100);
MATHEMATICA
Table[(18n-15+I^(2n)+(3-I)*I^(-n)+(3+I)*I^n)/8, {n, 80}] (* Wesley Ivan Hurt, Jun 07 2016 *)
Select[Range[0, 150], MemberQ[{0, 2, 5, 8}, Mod[#, 9]]&] (* Harvey P. Dale, Jan 02 2019 *)
LinearRecurrence[{1, 0, 0, 1, -1}, {0, 2, 5, 8, 9}, 70] (* Harvey P. Dale, Jan 15 2022 *)
PROG
(Magma) [n : n in [0..150] | n mod 9 in [0, 2, 5, 8]]; // Wesley Ivan Hurt, Jun 07 2016
(Python)
def A174438(n): return (0, 2, 5, 8)[n&3]+9*(n>>2) # Chai Wah Wu, Jan 30 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary Detlefs, Mar 19 2010
EXTENSIONS
a(23) corrected by Chai Wah Wu, Jun 10 2016
STATUS
approved