I think the main mistake you have made is that n = (x-y)(x+y) = x^2 - y^2 and not x^2 + y^2.
Use Fermat's algorithm to find factors for the following integers: 175,557
I know that Fermat's algorithm shows you that, given a number n, for integers x and y, n= x2+y2 so n= (x+y)(x-y)
Using a method I was shown:
I took [√175,557] which is 419.
4192 is not 175,557,
so I took n+1 (which is 420) and computed 4202 - 4192= 823 which is also not a perfect square, and therefore not a factor of 175,577.
I continued this pattern for a ton of numbers, increasing by one each time, the way we had been shown in class. After 40 test numbers, I realized I am obviously doing something wrong. I would greatly appreciate it if someone could help redirect me in the correct way to use Fermat's algorithm on prime factorization.