OFFSET
0,2
COMMENTS
A variant is given by A277617, defined in the same way but starting with a(1) = 1. Another variant is A277618, which is defined in a similar way, but with primes instead of squares.
It turns out that the steps a(n+1)-a(n) are either +4 or -9, no other squares occur as distances between successive terms. Indeed, one finds a(13) = 13 and all numbers from 0 to 12 occur as a(n) for 0 <= n <= 12. So there are no "holes", which entails the periodicity. More precisely, a({0, ..., 13k-1}) = {0, ..., 13k-1} and a(13k) = 13k for all k. This also implies that the sequence is a permutation of the nonnegative integers. - M. F. Hasler, Oct 24 2016
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,0,0,0,0,1,-1).
FORMULA
a(n+13) = a(n)+13 for all n.
From Chai Wah Wu, Mar 30 2023: (Start)
a(n) = a(n-1) + a(n-13) - a(n-14) for n > 13.
G.f.: x*(4*x^12 + 4*x^11 + 4*x^10 - 9*x^9 + 4*x^8 + 4*x^7 - 9*x^6 + 4*x^5 + 4*x^4 - 9*x^3 + 4*x^2 + 4*x + 4)/(x^14 - x^13 - x + 1). (End)
EXAMPLE
The possible (absolute) differences between subsequent terms are the squares larger than one, i.e., { 4, 9, 16, ... }.
After 0, the smallest possibility is 0 + 2^2 = 4, the next one is 4 + 2^2 = 8, and then 8 + 2^2 = 12. Now the next term is 12 - 3^2 = 3, thereafter 3 + 2^2 = 7, etc.
In a similar way, 11 is followed by 11 - 3^2, and 10 is followed by 10 - 3^2 = 1.
Thereafter, the next step of -9 will be after 25.
The sequence of steps (first differences) consists of repetitions of the 13 terms (4, 4, 4, -9, 4, 4, -9, 4, 4, -9, 4, 4, 4) which sum to 13.
PROG
(PARI) {u=[a=0]; (chk(n)=(!#u||(n>u[1]&&!setsearch(u, n)))&&(u=setunion(u, [n]))&&!while(#u>1&&u[2]==u[1]+1, u=u[^1])); for(n=1, 99, print1(a", "); for(k=-sqrtint(a+!a-1), 9e9, k^2>1||next; chk(a+k*abs(k))||next; a+=k*abs(k); break))} \\ M. F. Hasler, Oct 23 2016
(PARI) A277616(n, i=[0, 4, 8, 12, 3, 7, 11, 2, 6, 10, 1, 5, 9])=i[n%#i+1]+n\#i*#i \\ M. F. Hasler, Oct 24 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Eric Angelini, Oct 23 2016
STATUS
approved