OFFSET
1,3
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,2,-2).
FORMULA
a(n) = [x^n] (x + x^2 + x^3 + x^4 - x^5 - x^6 - x^7)/((-1 + x)*(-1 + 2*x^4)).
a(n) = a(n-1) + 2*a(n-4) - 2*a(n-5) for n > 8. - Chai Wah Wu, Jun 28 2025
MAPLE
isa := n -> andmap(j -> modp(binomial(n, j), 8) > 0, [seq(0..n)]): select(isa, [seq(0..200)]);
# Or, using the o.g.f.:
gf := (x + x^2 + x^3 + x^4 - x^5 - x^6 - x^7)/((-1 + x)*(-1 + 2*x^4)): ser := series(gf, x, 60): seq(coeff(ser, x, n), n = 0..53);
MATHEMATICA
LinearRecurrence[{1, 0, 0, 2, -2}, Range[0, 7], 60] (* Paolo Xausa, Jun 30 2025 *)
PROG
(Python)
def seq_gen():
n, c, value = 0, 1, 3
for v in [0, 1, 2]: yield v
while True:
yield value
value += c
n += 1
if n == 4:
n = 0
c += c
term = seq_gen()
print([next(term) for _ in range(54)])
CROSSREFS
KEYWORD
nonn
AUTHOR
Peter Luschny, Jun 28 2025
STATUS
approved
