OFFSET
1,3
COMMENTS
List of pairs of numbers with following properties:
(1) The numbers in each pair are consecutive.
(2) At least one integer is a square.
(3) The sum of each pair is another square.
(4) The position of the square term oscillates between left and right.
(5) The triple formed by the pair and the square root of their sum is a Pythagorean triple.
PROG
(Python)
# a Python 3.7 program to arrive at Pell-Fermat type Pythagorean triples below a given/entered number.
import math
number = None
# Taking the input from user
number = 10000000
squareList = []
subPythagoreanTriple= []
needed = 1.0
while(needed <= number):
root = math.sqrt(needed)
if int(root + 0.5) ** 2 == needed:
squareList.append(needed)
flag = True
else:
#print(number, "is not a perfect square")
pass
flag = None
needed = needed + 1
def checkSubPythagoreanTriple():
for i in squareList:
SPTless = i-1
SPTmore = i+1
firstSide = 2*i - 1
secondSide = 2*i + 1
firstSideRoot = math.sqrt(firstSide)
secondSideRoot = math.sqrt(secondSide)
if int(firstSideRoot + 0.5) ** 2 == firstSide or int(secondSideRoot + 0.5) ** 2 == secondSide :
if(i%2 == 1):
subPythagoreanTriple.append(int(i-1))
subPythagoreanTriple.append(int(i))
else:
subPythagoreanTriple.append(int(i))
subPythagoreanTriple.append(int(i+1))
else:
pass
def main():
checkSubPythagoreanTriple()
main()
print(str(subPythagoreanTriple))
(Magma) a:=[0, 1]; for k in [2..1000000] do if IsSquare(2*k*k+1) then a:=a cat [k^2, k^2+1]; else if IsSquare(2*k*k-1) then a:=a cat [k^2-1, k^2]; end if; end if; end for; a; // Marius A. Burtea, Jan 21 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Chandrasekhar Karri, Jan 13 2020
EXTENSIONS
More terms from Marius A. Burtea, Jan 13 2020
STATUS
approved