# PYTHAGOREAN THEOREM • ### Question

• I am trying to write a program to calculate if there are any whole numbers in a Pythagorean theorem where A and B are equal (a*a)+(a*a)=c squared and the square root of c is also a whole number.  it is simple program to write I know, but how do I write a "IF Then" that would only give a whole number without rounding it off?  if (c=math.integer) then... or if (c=math.wholenumber) then...?
Sunday, June 25, 2017 4:59 PM

• You can use If c=Math.round(c) Then

Jan [ WhTurner ] The Netherlands

Sunday, June 25, 2017 5:38 PM
• I think it is fairly easy to prove algebraically that it is not possible:

a*a + a*a = c*c

c = sqrt(2)*a => sqrt(2) = c/a

sqrt(2) is irrational, therfore a and c cannot be integer numbers.

Fermat's last theorem is a completely different matter....
Sunday, June 25, 2017 6:36 PM
• If A and B are not equal, there are many a,b,c whole number sets that satisfy (a*a)+(b*b)=(c*c).  In this situation, you can use:

```If Math.Floor(c) = c Then
' c is whole number
EndIf ```

Nonki Takahashi

Thursday, June 29, 2017 4:35 PM

### All replies

• You can use If c=Math.round(c) Then

Jan [ WhTurner ] The Netherlands

Sunday, June 25, 2017 5:38 PM
• I think it is fairly easy to prove algebraically that it is not possible:

a*a + a*a = c*c

c = sqrt(2)*a => sqrt(2) = c/a

sqrt(2) is irrational, therfore a and c cannot be integer numbers.

Fermat's last theorem is a completely different matter....
Sunday, June 25, 2017 6:36 PM
• If A and B are not equal, there are many a,b,c whole number sets that satisfy (a*a)+(b*b)=(c*c).  In this situation, you can use:

```If Math.Floor(c) = c Then
' c is whole number
EndIf ```

Nonki Takahashi

Thursday, June 29, 2017 4:35 PM