OFFSET
1,2
COMMENTS
7 is the unique prime in this sequence. If m is in this sequence, then 3*m + 4 = k^2 for k is nonzero integer, that is, m = (k^2 - 4)/3 = (k-2)*(k+2)/3. So m can be only prime if one of divisors is prime and another one is 1. Otherwise there should be more than 1 prime divisors, that is n must be composite. - Altug Alkan, Apr 12 2016
From Ray Chandler, Apr 12 2016: (Start)
Square roots of resulting squares gives A001651 (with a different starting point).
The sequence terms are the exponents in the expansion of Sum_{n >= 0} q^n*(1 - q)*(1 - q^3)*...*(1 - q^(2*n+1)) = 1 - q^4 - q^7 + q^15 + q^20 - q^32 - q^50 + + - - .... - Peter Bala, Dec 19 2024
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
O.g.f.: x^2*(4 + 3*x - x^3)/((1 + x)^2*(1 - x)^3).
E.g.f.: 1 + (1 - 2*x)*exp(-x)/8 - 3*(3 - 4*x - 2*x^2)*exp(x)/8.
a(n) = A001082(n+1) - 1 = (6*n*(n+1) + (2*n + 1)*(-1)^n - 1)/8 - 1. Therefore: a(2*k+1) = k*(3*k+4), a(2*k) = (k+1)*(3*k-1).
Sum_{n>=2} 1/a(n) = 19/16 - Pi/(4*sqrt(3)). - Amiram Eldar, Jul 26 2024
EXAMPLE
a(4) = 32 because 3*32 + 4 = 100 = 10*10.
MATHEMATICA
Select[Range[0, 2500], IntegerQ@ Sqrt[3 # + 4] &] (* Michael De Vlieger, Apr 12 2016 *)
LinearRecurrence[{1, 2, -2, -1, 1}, {0, 4, 7, 15, 20}, 60] (* Harvey P. Dale, Dec 09 2016 *)
PROG
(Magma) [n: n in [0..4000] | IsSquare(3*n+4)];
(Python)
from gmpy2 import is_square
for n in range(0, 10**5):
if(is_square(3*n+4)):print(n)
# Soumil Mandal, Apr 12 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Juri-Stepan Gerasimov, Apr 12 2016
EXTENSIONS
Edited and extended by Bruno Berselli, Apr 12 2016
STATUS
approved