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 A082389 #28 Dec 02 2024 13:06:32 %S A082389 1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,2,1,2, %T A082389 1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,2,1,2, %U A082389 1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2,1,2,1,2,2,1,2,2,1,2,1,2,2 %N A082389 a(n) = floor((n+2)*phi) - floor((n+1)*phi) where phi=(1+sqrt(5))/2. %C A082389 Alternative descriptions (1): unique positive integer sequence taking values in {1,2} satisfying a(1)=1, a(2)=2 and a(a(1)+...+a(n))=a(n) for n >= 3. %C A082389 (2) Start with 1,2; then for any k>=1, a(a(1)+...+a(k))=a(k), fill in any undefined terms by the rule that a(t) = 1 if a(t-1) = 2 and a(t) = 2 if a(t-1) = 1. %C A082389 (3) a(1)= 1, a(2)=2, a(a(1)+a(2)+...+a(n))=a(n); a(a(1)+a(2)+...+a(n)+1)=3-a(n). %C A082389 More generally, the sequence a(n)=floor(r*(n+2))-floor(r*(n+1)), r= (1/2) *(z+sqrt(z^2+4)), z integer >=1, is defined by a(1), a(2) and a(a(1)+a(2)+...+a(n)+f(z))=a(n); a(a(1)+a(2)+...+a(n)+f(z)+1)=(2z+1)-a(n) where f(1)=0, f(z)=z-2 for z>=2. %H A082389 Harvey P. Dale, <a href="/A082389/b082389.txt">Table of n, a(n) for n = 1..1000</a> %F A082389 a(n) = A014675(n+1); sum(k = 1, n, a(k)) = A058065(n) %F A082389 Apparently a(n) = A059426(n). %F A082389 a(n) = A066096(n+2)-A066096(n+1). - _R. J. Mathar_, Aug 02 2024 %e A082389 a(1)+a(2)=3 and a(a(1)+a(2)) must be a(2) so a(3)=2. Therefore a(a(1)+a(2)+a(3))=a(5)=2 and from the rule the "hole" a(4) is 1. Hence sequence begins 1,2,2,1,2,... %p A082389 A082389:=n->floor((n+2)*(1+sqrt(5))/2) - floor((n+1)*(1+sqrt(5))/2): seq(A082389(n), n=1..300); # _Wesley Ivan Hurt_, Jan 16 2017 %t A082389 Rest@Nest[ Flatten[ # /. {1 -> 2, 2 -> {2, 1}}] &, {1}, 11] (* _Robert G. Wilson v_, Jan 26 2006 *) %t A082389 #[[2]]-#[[1]]&/@Partition[Table[Floor[GoldenRatio n],{n,0,110}],2,1] (* _Harvey P. Dale_, Sep 04 2019 *) %t A082389 Differences[Floor[GoldenRatio Range[2,150]]] (* _Harvey P. Dale_, Dec 02 2024 *) %o A082389 (Python) %o A082389 from math import isqrt %o A082389 def A082389(n): return (n+2+isqrt(m:=5*(n+2)**2)>>1)-(n+1+isqrt(m-10*n-15)>>1) # _Chai Wah Wu_, Aug 29 2022 %Y A082389 Same as A014675 without the first term. %K A082389 nonn,nice,easy %O A082389 1,2 %A A082389 _Benoit Cloitre_, Apr 14 2003