#1
|
|||
|
|||
Numbers in a Triangle: Curious Question
Assume we arrange numbers in a triage like this,
<font class="small">Code:</font><hr /><pre> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ... </pre><hr /> Is it possible to create a formula(s) to find where X lies in the triangle? ie x=9 is row 4 position 3(or 5) I am curious as to how this is done. Ive searched google for numbered triangles and all that I can find is Pascals triangle, which isn't the same thing. Is there a name for numbers arranged this way? Right now I think that finding the row would be a function involving the square root and the column(positon) a mod function. Any help in the right direction to figuring this out would be appreciated. Thanks |
#2
|
|||
|
|||
Re: Numbers in a Triangle: Curious Question
All the triangular numbers are easy to work with .
1=1*2/2 is in the first position , first row 3=3*2/2 is in the second position ,second row 6=4*3/2 is in the third position , third row 10=5*4/2 is in the fourth position , fourth row . Notice that 2c2+2 =3c2 3c2+3 =4c2 4c2+4 =5c2 5c2+5 =6c2 Now every number in between two successive triangular numbers can be identified relatively easy using Mod Arithmetic . The position of a number in a row becomes the remainder if we can identify the two successive triangular numbers . Take 151 . Multiply this number by 2 and take the square root of it . Now take the least integer value which is 17 and add 1 to it which should tell you what row this number is in . 17*16/2 = 136 and so 151-136 =15 tells you the position of that number along the row . Here is the formula or generalization which computes the row first and then the position along the row . ([sqrt(2x)] + 1 , x- [sqrt(2x)]*([sqrt(2x)]-1)/2 ) |
#3
|
|||
|
|||
Re: Numbers in a Triangle: Curious Question
Awesome! Thanks for the extra insight into the combination stuff, I'll look into it also.
I thought it was easy but I couldn't quite figure it myself. I was close though. Thanks for answering everything and then some. |
#4
|
|||
|
|||
Re: Numbers in a Triangle: Curious Question
Let me also clarify that you should take the greatest integer value if the number is closest to the first integer greater than x . Otherwise you use the least integer value function which is the greatest integer less than the value x .
Or, just round the number to the closest positive integer . [sqrt(11*2)]=5 which is the 5th row . [sqrt(10*2)] =4 which is the 4th row . |
|
|