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 A267077 #31 Nov 29 2023 20:23:15 %S A267077 1,35,30,18135,189,27,321300,23760,1188585957,1656083,26,244894427400, %T A267077 82093908624206325,1858717755529547,86478,21491811639746039592, %U A267077 26135932603458945934958445,353382195058506640426335,26780050,7859354769338288038121982384,274554988002 %N A267077 Least m>0 for which m*n^2 + 1 is a square and m*triangular(n) + 1 is a triangular number (A000217). Or -1 if no such m exists. %H A267077 Don Reble, <a href="/A267077/b267077.txt">Table of n, a(n) for n = 0..300</a> %e A267077 26*10^2+1 = 2601 is a square, and 26*10*11/2+1 = 1431 = triangular(53), and 26 is the smallest such multiplier, therefore a(10) = 26. %o A267077 (Python) %o A267077 from math import sqrt %o A267077 def A267077(n): %o A267077 if n == 0: %o A267077 return 1 %o A267077 u,v,t,w = max(8,2*n),max(4,n)**2-9,4*n*(n+1),n**2 %o A267077 while True: %o A267077 m,r = divmod(v,t) %o A267077 if not r and int(sqrt(m*w+1))**2 == m*w+1: %o A267077 return m %o A267077 v += u+1 %o A267077 u += 2 # _Chai Wah Wu_, Jan 15 2016 %o A267077 (Python) %o A267077 #!/usr/bin/python3 %o A267077 # This sequence is easy if you use a Pell-equation solver such as labmath.py %o A267077 # Solve the A267077 Pell equation: %o A267077 # nx^2 - (4n+4)y^2 = 5n-4; but also y^2 == 1 mod n^2 %o A267077 # Let u = nx, then # u^2 - n*(4n+4)y^2 = n*(5n-4) %o A267077 # and (y > n) and (u == 0 mod n) and (y^2 == 1 mod n^2) %o A267077 # (y > n makes m > 0) %o A267077 # Report m = (y^2 - 1) / n^2 %o A267077 import labmath %o A267077 print(0, 1) %o A267077 print(1, 35) # When n<2, the Pell equation is elliptical. %o A267077 for nn in range(2,1001): %o A267077 nsq = nn * nn %o A267077 ps = labmath.pell(nn*(4*nn+4), nn*(5*nn-4)) %o A267077 uu,yy = next(ps[0]) %o A267077 while (yy <= nn) or ((uu % nn) != 0) or ((yy*yy) % nsq != 1): %o A267077 uu,yy = next(ps[0]) %o A267077 print(nn, (yy*yy - 1) // nsq) %o A267077 # From _Don Reble_, Apr 15 2022, added by _N. J. A. Sloane_, Apr 15 2022. %Y A267077 Cf. A000217, A000290, A035096, A061782, A067872, A188621. %K A267077 nonn %O A267077 0,2 %A A267077 _Alex Ratushnyak_, Jan 10 2016 %E A267077 a(12)-a(15) from _Chai Wah Wu_, Jan 16 2016 %E A267077 a(16) and beyond from _Don Reble_, Apr 15 2022