cp's OEIS Frontend

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.

A229909 Triangular numbers t such that the following are three triangular numbers: x, y, x+y, where x and y are distances from t to the two nearest squares.

This page as a plain text file.
%I A229909 #23 Oct 16 2024 21:21:12
%S A229909 1,2080,8038045
%N A229909 Triangular numbers t such that the following are three triangular numbers: x, y, x+y, where x and y are distances from t to the two nearest squares.
%C A229909 No more terms through 10^34. - _Jon E. Schoenfield_, Feb 09 2014
%e A229909 2080 is in the sequence because the following three are triangular numbers:
%e A229909 2080-2025 = 55,
%e A229909 2116-2080 = 36,
%e A229909 55 + 36 = 91.
%e A229909 2025 = 45^2 and 2116 = 46^2 are the nearest to 2080 squares.
%t A229909 ttnQ[n_]:=Module[{s=Sqrt[n],x,y},x=If[IntegerQ[s],n-(s-1)^2,n- Floor[ s]^2];y=If[IntegerQ[s],(s+1)^2-n,Ceiling[s]^2-n];AllTrue[ {Sqrt[ 8x+1],Sqrt[8y+1],Sqrt[8(x+y)+1]},OddQ]]; Join[{1},Select[Accumulate[ Range[10000]],ttnQ]] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, May 30 2015 *)
%o A229909 (Python)
%o A229909 import math
%o A229909 def isTriangular(a):
%o A229909     a+=a
%o A229909     sr = int(math.sqrt(a))
%o A229909     return (a==sr*(sr+1))
%o A229909 for n in range(1, 1000000000):
%o A229909     tn = int(n*(n+1)/2)  # = x+y = distance between squares
%o A229909     if tn&1:
%o A229909         k = tn>>1
%o A229909         k*= k       # square below t
%o A229909         a = int(math.sqrt(k*2))
%o A229909         t = a*(a+1)/2
%o A229909         if t <= k:
%o A229909             a+=1
%o A229909             t+=a
%o A229909         ktn = k+tn   # square above t
%o A229909         while t <= ktn:  # check if x and y are triangular:
%o A229909             if isTriangular(t-k) and isTriangular(ktn-t):
%o A229909                 print(int(t))
%o A229909             a+=1
%o A229909             t+=a
%o A229909     if (n&0xfffff)==0: print('.', end='')
%Y A229909 Cf. A000217, A000290, A234143.
%K A229909 nonn,bref,hard,more
%O A229909 1,2
%A A229909 _Alex Ratushnyak_, Dec 19 2013