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 A361381 #32 Feb 04 2024 15:39:22 %S A361381 2,4,1,2,1,4,2,1,6,2,6,4,1,1,2,8,4,4,2,1,2,2,3,2,10,12,4,2,1,4,6,7,6, %T A361381 3,4,1,2,10,2,6,8,7,5,2,4,4,1,2,1,10,2,5,8,4,16,4,11,1,2,12,2,9,6,5,2, %U A361381 6,9,6,10,10,4,1,2,12,10,3,6,4,14,9,4,18,4,4,2,1,2,3,20,10,4,5,8,10,10,18,2,22 %N A361381 In continued fraction convergents of sqrt(d), where d=A005117(n) (squarefree numbers), the position of a/b where abs(a^2 - d*b^2) = 1 or 4. %C A361381 The golden ratio is the fundamental unit for sqrt(5), but 1/1 isn't a convergent, so this sequence starts with squarefree number A005117(5)=6. %e A361381 A005117(13)=19. 170^2 - 19*39^2 = 1. The 6th convergent of sqrt(19) is 170/39. %e A361381 A005117(14)=21. 5^2 - 21*1^2 = 4. The 2nd convergent of sqrt(21) is 5/1. %e A361381 A005117(15)=22. 197^2 - 22*42^2 = 1. The 6th convergent of sqrt(22) is 197/42. %e A361381 A005117(16)=23. 24^2 - 23*5^2 = 1. The 4th convergent of sqrt(23) is 24/5. %e A361381 Corresponding fundamental units are 170+39*sqrt(19), 5+sqrt(21), 197+42*sqrt(22) and 24+5*sqrt(23). %p A361381 f:= proc(x) local CF, k,v,w; %p A361381 uses NumberTheory; %p A361381 CF:= ContinuedFraction(sqrt(x)); %p A361381 for k from 0 do %p A361381 v:= Convergent(CF,k); %p A361381 w:= abs(numer(v)^2 - x*denom(v)^2); %p A361381 if w = 1 or w = 4 then return k+1 fi; %p A361381 od %p A361381 end proc: %p A361381 count:= 0: R:= NULL: %p A361381 for i from 6 while count < 100 do if NumberTheory:-IsSquareFree(i) then R:= R, f(i); count:= count+1 fi %p A361381 od: %p A361381 R; # _Robert Israel_, Mar 12 2023 %t A361381 (* store A005117 and A107997 first *) Flatten[Table[sqr = Sqrt[A005117[[n]]]; %t A361381 fun = RootReduce[NumberFieldFundamentalUnits[Sqrt[A005117[[n]]]]][[1]]; %t A361381 forcon = If[MemberQ[A107997, A005117[[n]]], RootReduce[2 fun], fun]; %t A361381 converge = Convergents[ContinuedFraction[N[sqr, 140]]]; %t A361381 Flatten[Position[converge, Abs[forcon[[1]]/(forcon[[2]]/ sqr)]]], {n, 4, 101}]] %Y A361381 Cf. A005117, A107997. %K A361381 nonn %O A361381 5,1 %A A361381 _Ed Pegg Jr_, Mar 09 2023