Associated Topics || Dr. Math Home || Search Dr. Math

Testing for Triangular Numbers

```
Date: 06/09/99 at 23:24:19
From: agnes
Subject: How to know if 12456, 1225, 13456 are triangular or sq. no.

out whether 12456, 1225, and 13456 are triangualar or square numbers?
I know that the formula of a triangualar number is n(n+1)/2, but I
don't know how it works.

Agnes
```

```
Date: 06/10/99 at 16:46:31
From: Doctor Terrel
Subject: Re: How to know if 12456, 1225, 13456 are triangular or sq.
no.

Dear Agnes,

In order to know if a number is triangular or not, it's helpful to
know the formula for triangular numbers:

n(n+1)
T = --------
2

Given a number to test, I'd do it this way:

For example, 66.

66 = n(n+1)/2
132 = n(n+1)

Now I reason that n and (n+1) are numbers relatively close together.
So if I found the square root of 132, it should be close to the
smaller "n" .

Sure enough, sqrt(132) = 11.xxxxx.

So if I now use 11 in the formula for "n" I have

11(11 + 1)/2 = 11(12)/2 = 11(6) = 66.  And it works!

If another number, like 100, was tested in this way, things don't work
out.

100 = n(n+1)/2
200 = n(n+1)

sqrt(200) = 14.xxxx

But 14(15)/2  = 105, which does not equal 100.  etc. Okay?

Testing  for squares should be easy on a calculator, if the number
isn't too large of course. But do remember one simple fact: if the
number ends with a 2, 3, 7, or 8, it CANNOT be square, no matter what.
Do you see why?

- Doctor Terrel, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 11/04/2001 at 19:46:41
From: Paul Schuler
Subject: Triangular numbers

Is there a formula to calculate the following:

A person enters a number. You need to find out if the number entered
is the triangular value of another integer.

For example, if a person enters the number 15, the formula would return
the value 5. I know how to calculate the triangular value n(n+1)/2;
I just can't see how to reverse this.

Thank you.
```

```
Date: 11/05/2001 at 05:08:06
From: Doctor Floor
Subject: Re: Triangular numbers

Hi, Paul,

Thanks for writing.

Dr. Terrel's answer does not fully satisfy me.

Suppose we have a triangular number:

n(n+1)
T = ------
2

then this is equivalent to

8T = 4n^2 + 4n

and

8T + 1 = 4n^2 + 4n + 1 = (2n + 1)^2

So a number T is triangular if and only if 8T + 1 is an odd perfect
square.

If you need more help, just write back.

Best regards,
- Doctor Floor, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 07/21/2001 at 20:09:19
From: Matt
Subject: Testing for triangular numbers

Please tell me the formula to test for triangular numbers -
e.g., Is there a formula to test if X is a triangular number?

Thanks,
Matt
```

```
Date: 07/23/2001 at 17:20:45
From: Doctor Pete
Subject: Re: Testing for triangular numbers

Hi,

A triangular number has the form n(n+1)/2, for some integer n > 0.
So, to see if a number x is triangular, let

x = n(n+1)/2.

Solving for x, we obtain

n^2 + n - 2x = 0
or
n = (Sqrt[1+8x] - 1)/2.

Note n must be an integer greater than 0. Therefore, 1+8x must be
an odd perfect square, and as you can see, whenever it is, we get
a value of n that "works."  So the test to see if x is triangular is
to calculate 1+8x and see if it is odd, and a perfect square.

- Doctor Pete, The Math Forum
http://mathforum.com/dr.math/
```
Associated Topics:
Middle School Algebra