login
A277616
Lexicographically earliest sequence such that |a(n+1)-a(n)| is a square > 1 (for all n) and no number occurs twice; a(0) = 0.
5
0, 4, 8, 12, 3, 7, 11, 2, 6, 10, 1, 5, 9, 13, 17, 21, 25, 16, 20, 24, 15, 19, 23, 14, 18, 22, 26, 30, 34, 38, 29, 33, 37, 28, 32, 36, 27, 31, 35, 39, 43, 47, 51, 42, 46, 50, 41, 45, 49, 40, 44, 48, 52, 56, 60, 64, 55, 59, 63, 54, 58, 62, 53, 57, 61, 65, 69, 73, 77, 68, 72, 76, 67, 71, 75, 66, 70, 74, 78, 82, 86, 90, 81, 85, 89, 80, 84, 88, 79, 83, 87
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
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
Sequence in context: A120230 A086480 A260249 * A211016 A103696 A196267
KEYWORD
nonn,easy
AUTHOR
Eric Angelini, Oct 23 2016
STATUS
approved