OFFSET
1,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
EXAMPLE
Solutions for n = 7:
-----------------------------------
1 +8 +27 +64 +125 +216 +343 = 784.
1 +8 +27 +64 +125 +216 -343 = 98.
1 +8 +27 -64 +125 -216 +343 = 224.
1 +8 +27 -64 +125 -216 -343 = -462.
1 +8 +27 -64 -125 +216 +343 = 406.
1 +8 +27 -64 -125 +216 -343 = -280.
1 +8 -27 -64 +125 +216 +343 = 602.
1 +8 -27 -64 +125 +216 -343 = -84.
1 -8 +27 +64 +125 -216 +343 = 336.
1 -8 +27 +64 +125 -216 -343 = -350.
1 -8 +27 +64 -125 +216 +343 = 518.
1 -8 +27 +64 -125 +216 -343 = -168.
1 -8 +27 -64 -125 -216 +343 = -42.
1 -8 +27 -64 -125 -216 -343 = -728.
1 -8 -27 +64 +125 +216 +343 = 714.
1 -8 -27 +64 +125 +216 -343 = 28.
1 -8 -27 -64 +125 -216 +343 = 154.
1 -8 -27 -64 +125 -216 -343 = -532.
1 -8 -27 -64 -125 +216 +343 = 336.
1 -8 -27 -64 -125 +216 -343 = -350.
MAPLE
b:= proc(n, i, m) option remember; `if`(i=0, `if`(n=0, 1, 0),
add(b(irem(n+j, m), i-1, m), j=[i^3, m-i^3]))
end:
a:= n-> b(0, n-1, n):
seq(a(n), n=1..60); # Alois P. Heinz, Mar 01 2018
MATHEMATICA
b[n_, i_, m_] := b[n, i, m] = If[i == 0, If[n == 0, 1, 0],
Sum[b[Mod[n + j, m], i - 1, m], {j, {i^3, m - i^3}}]];
a[n_] := b[0, n - 1, n];
Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Mar 19 2022, after Alois P. Heinz *)
PROG
(Ruby)
def A(n)
ary = [1] + Array.new(n - 1, 0)
(1..n).each{|i|
i3 = 2 * i * i * i
a = ary.clone
(0..n - 1).each{|j| a[(j + i3) % n] += ary[j]}
ary = a
}
ary[((n * (n + 1)) ** 2 / 4) % n] / 2
end
def A300269(n)
(1..n).map{|i| A(i)}
end
p A300269(100)
(PARI) a(n) = my (v=vector(n, k, k==1)); for (i=2, n, v = vector(n, k, v[1 + (k-i^3)%n] + v[1 + (k+i^3)%n])); v[1] \\ Rémy Sigrist, Mar 01 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Mar 01 2018
EXTENSIONS
More terms from Alois P. Heinz, Mar 01 2018
STATUS
approved