login
A338774
a(n) is the greatest k such that 0 <= k < n and the k latest terms so far sum up to a square number.
3
0, 1, 2, 0, 1, 5, 6, 0, 1, 9, 10, 0, 1, 13, 14, 0, 1, 17, 18, 8, 0, 1, 3, 3, 0, 1, 19, 0, 1, 18, 24, 0, 1, 27, 28, 18, 16, 1, 19, 3, 38, 36, 39, 40, 0, 1, 43, 44, 0, 1, 47, 48, 0, 1, 51, 52, 16, 1, 7, 0, 1, 13, 21, 39, 34, 38, 64, 62, 65, 66, 43, 40, 63, 19
OFFSET
1,3
COMMENTS
If a(n) = 0, then a(n+1) = 1 and a(n+2) >= 2.
LINKS
FORMULA
a(n) < n.
EXAMPLE
The first terms, alongside the corresponding squares, are:
n a(n) Corresponding squares (A338780(n)^2)
-- ---- ------------------------------------
1 0 0^2 (empty sum)
2 1 0 = 0^2
3 2 0+1 = 1^2
4 0 0^2 (empty sum)
5 1 0 = 0^2
6 5 0+1+2+0+1 = 2^2
7 6 0+1+2+0+1+5 = 3^2
8 0 0^2 (empty sum)
9 1 0 = 0^2
10 9 0+1+2+0+1+5+6+0+1 = 4^2
PROG
(PARI) See Links section.
CROSSREFS
See A338773 for a similar sequence.
Cf. A338780.
Sequence in context: A094456 A010028 A151860 * A330891 A089627 A306534
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Nov 08 2020
STATUS
approved