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.
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
Examples
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.
Links
- N. J. A. Sloane, Table of n, a(n) for n = 0..10000
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,0,0,0,0,0,1,-1).
Programs
-
Maple
A277616 := proc(n) local L,i,t1; option remember; L := [0, 4, 8, 12, 3, 7, 11, 2, 6, 10, 1, 5, 9, 13]; if n <= 13 then return(L[n+1]) else A277616(n-13)+13; fi; end; # N. J. A. Sloane, Jan 12 2025
-
Mathematica
LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1}, {0, 4, 8, 12, 3, 7, 11, 2, 6, 10, 1, 5, 9, 13}, 100] (* Paolo Xausa, Jan 16 2025 *)
-
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
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)
Comments