This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A038122 #29 Apr 17 2025 23:21:14 %S A038122 1,3,0,16,15,63,8,0,3,1,0,0,1,3,0,4,3,3,4,0,3,1,0,0,1,3,0,4,3,3,4,0,3, %T A038122 1,0,0,1,3,0,4,3,3,4,0,3,1,0,0,1,3,0,4,3,3,4,0,3,1,0,0,1,3,0,4,3,3,4, %U A038122 0,3,1,0,0,1,3,0,4,3,3,4,0,3,1,0,0,1,3,0,4,3,3,4,0,3,1,0,0,1,3,0,4,3,3,4,0 %N A038122 Start with {1,2,...,n}, replace any two numbers a,b with |a^2-b^2|, repeat until single number k remains; a(n) = minimal value of k. %C A038122 Due mostly to the efforts of _Dean Hickerson_, supported by David W. Wilson and Michael Kleber, it is now known that this has period 12 beginning at n=8. %H A038122 Dean Hickerson and Michael Kleber, <a href="https://cs.uwaterloo.ca/journals/JIS/HICKERSON/hickerson.html">Reducing a Set by Subtracting Squares</a>, J. Integer Sequences, Vol. 2, 1999, #4. %H A038122 <a href="/index/Rec#order_09">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,1,0,0,-1,0,0,1). %F A038122 For n<4 and n>7, a(n) = n*(n+1)/2 mod 6 = A010875(A000217(n)). - _Henry Bottomley_, Feb 24 2003 %F A038122 a(n) = a(n-3)-a(n-6)+a(n-9) for n>16. - _Colin Barker_, Oct 01 2014 %F A038122 G.f.: x*(4*x^15 +60*x^14 +12*x^13 +8*x^12 -60*x^11 -12*x^10 -8*x^9 +60*x^8 +12*x^7 +7*x^6 -63*x^5 -12*x^4 -15*x^3 -3*x -1) / ((x -1)*(x^2 +1)*(x^2 +x +1)*(x^4 -x^2 +1)). - _Colin Barker_, Oct 01 2014 %e A038122 a(2) = 3 from (1,2); a(3) = 0 from ((1,2),3); a(4) = 16 from (((1,2),3),4); a(5) = 15 from ((((2,3),5),1),4) %e A038122 a(6) = 63 from (((1,4),(3,5)),(2,6)) [ _Michael Kleber_ ] %e A038122 a(7) = 8 from (((((4,5),6),(2,7)),1),3) [ Kleber ] %e A038122 a(8) = 0 from ((((4,5),7)(2,6))((1,3),8)) [ Guy ] %e A038122 a(9) = 3 from (2,(1,(((6,7),((3,4),8)),(5,9)))) [ Kleber ] %e A038122 a(10)= 1 from ((((((((4,5),9),6),(8,10)),2),3),7),1) [ This and the following are due to _Dean Hickerson_ ] %e A038122 a(11)= 0 from ((((((3,7),(9,11)),6),(8,10)),(1,2)),(4,5)) %e A038122 a(12)= 0 from ((((((1,3),7),(8,10)),(((5,6),9),(11,12))),2),4) %e A038122 a(13)= 1 from (((((((((3,7),(9,11)),6),(8,10)),5),(12,13)),2),4),1) ... %t A038122 LinearRecurrence[{0,0,1,0,0,-1,0,0,1},{1,3,0,16,15,63,8,0,3,1,0,0,1,3,0,4},120] (* _Harvey P. Dale_, Jul 29 2015 *) %o A038122 (PARI) a(n)=if(n<4||n>7, n*(n+1)/2%6, [16, 15, 63, 8][n-3]) \\ _Charles R Greathouse IV_, Feb 10 2017 %o A038122 (Python) %o A038122 def A038122(n): return (16,15,63,8)[n-4] if 3<n<8 else (n*(n+1)>>1)%6 # _Chai Wah Wu_, Apr 17 2025 %K A038122 nonn,nice,easy %O A038122 1,2 %A A038122 _R. K. Guy_