%I #19 Jan 16 2025 06:55:02
%S 1,5,9,13,4,8,12,3,7,11,2,6,10,14,18,22,26,17,21,25,16,20,24,15,19,23,
%T 27,31,35,39,30,34,38,29,33,37,28,32,36,40,44,48,52,43,47,51,42,46,50,
%U 41,45,49,53,57,61,65,56,60,64,55,59,63,54,58,62,66,70,74,78,69,73,77,68,72,76,67,71,75,79,83,87,91,82,86,90,81,85,89,80,84,88
%N Lexicographically earliest positive sequence such that a(n+1)-a(n) is a square > 1 and no number occurs twice; a(1) = 1.
%C A variant of A277616, which is defined in the same way but starts with a(0) = 0.
%C Another variant is A277618, which is defined in a similar way, but with primes instead of squares. (The strictly positive variant is A065186.)
%H Paolo Xausa, <a href="/A277617/b277617.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rec#order_14">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,0,0,0,0,0,0,0,0,0,0,1,-1).
%F From _Chai Wah Wu_, Mar 30 2023: (Start)
%F a(n) = a(n-1) + a(n-13) - a(n-14) for n > 14.
%F G.f.: x*(3*x^13 + 4*x^12 + 4*x^11 - 9*x^10 + 4*x^9 + 4*x^8 - 9*x^7 + 4*x^6 + 4*x^5 - 9*x^4 + 4*x^3 + 4*x^2 + 4*x + 1)/(x^14 - x^13 - x + 1). (End)
%t LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1}, {1, 5, 9, 13, 4, 8, 12, 3, 7, 11, 2, 6, 10, 14}, 100] (* _Paolo Xausa_, Jan 16 2025 *)
%o (PARI) {u=[a=1];(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))}
%Y Cf. A277616, A277618, A065186.
%K nonn,easy
%O 1,2
%A _Eric Angelini_ and _M. F. Hasler_, Oct 23 2016