Im working on a problem (hopefully a simple one), my guess is there is an obvious, algebraic solution that I'm unaware of and I'm hoping you might shed some light on this?

Essentially, I intend to build a sieve for figurate numbers, I'll code this in a programming language such as C or VB or something.

What I would like to be able to do is to enter any real number and have my algorithm, routine check the number to see what figurate number it comes closest too.

Note that the following link, has a table of some of the more common formulas to derive a figurate number series in forward expanding exponential series (gnomonic growth) ;

Figurate Number -- from Wolfram MathWorld

(Table copied and pasted below for your reference)

However, what I need to do, Im guessing, is to re-write these formula so that they process backwards, taking a large number and scailing it down.

For example ;

If using the triangular figurate formula n(n+1) /2

39 (39+1) / 2 = 780

However, I want to reverse this process so that I enter 780 and I get 39

I'd like to be able to reverse ALL of the formula shown below, each and every statement

the end goal is that I will have developed for myself a small software program that accepts any real number and then checks that numberagainst all these formula to see which ones it matches or comes very close to, I realzie this sounds odd, but I'd like to be able to even enter irrationals and remainders, non-whole numbers are 'ok', i.e. a number may be close to a triangular number, i.e. say I have 783, then the app returns that it is close to a triangular number 780 with remainder 3

What Im hoping to ask of you, is are you aware of any onlne source where these reversed formula have already been compiled and are available? If not, thoughts on whether this can be done, and if so, any tips?

If you feel inclined to take a crack at re-writing the tetrahedral, triangular, and pentagonal formula, I'd love to review your approach - and hope to be ebale to re-write all of these.

Much thanks and sincere regards to you!

# Figurate numbers - deriving backwards

Started By
doc_starz
, Jun 15 2010 08:56 AM

5 replies to this topic

### #1

Posted 15 June 2010 - 08:56 AM

### #2

Posted 15 June 2010 - 09:14 AM

On good faith, I assume you've already snooped around Turtle's Non-Figurate Numbers and perhaps Don Blazys' Calculating the Fine Structure Constant. Donk, Modest, CraigD, and others have contributed some mighty fine code to familial problems of your sort.

Recently, I discovered that Wolfram Alpha's good for rejumbling formulas like the Polygonal numbers.

I'm sure Turtle will be along shortly, he tends to move at his own pace, to discuss things like the closeness of numbers and the likes with you.

I hope some of this helps if only indirectly. Let me know if you have any specific questions that I might attempt to answer which aren't covered in one of the threads already underway.

Welcome to Hypography, I look forward to continued discussion!

-Ian

Recently, I discovered that Wolfram Alpha's good for rejumbling formulas like the Polygonal numbers.

I'm sure Turtle will be along shortly, he tends to move at his own pace, to discuss things like the closeness of numbers and the likes with you.

I hope some of this helps if only indirectly. Let me know if you have any specific questions that I might attempt to answer which aren't covered in one of the threads already underway.

Welcome to Hypography, I look forward to continued discussion!

-Ian

### #3

Posted 15 June 2010 - 11:27 PM

To: doc starz

The formula for triangular numbers can be written as:

[math]\frac{n^2}{2}+\frac{n}{2}[/math]

"Backwards", this would be:

[math]\frac{\sqrt{8*n+1}-1}{2}[/math]

In general, for any polygonal of [math]s[/math] number of sides, we have:

[math]\left(\frac{s}{2}-1\right)*n^2-\left(\frac{s}{2}-2\right)*n[/math]

which "backwards" is:

[math]\frac{\sqrt{8*n*(s-2)+(s-4)^2}+s-4}{2*(s-2)}[/math]

I hope that helps, and welcome to Hypography, where the reside!

Don.

The formula for triangular numbers can be written as:

[math]\frac{n^2}{2}+\frac{n}{2}[/math]

"Backwards", this would be:

[math]\frac{\sqrt{8*n+1}-1}{2}[/math]

In general, for any polygonal of [math]s[/math] number of sides, we have:

[math]\left(\frac{s}{2}-1\right)*n^2-\left(\frac{s}{2}-2\right)*n[/math]

which "backwards" is:

[math]\frac{\sqrt{8*n*(s-2)+(s-4)^2}+s-4}{2*(s-2)}[/math]

I hope that helps, and welcome to Hypography, where the reside!

Don.

### #4

Posted 16 June 2010 - 01:37 AM

Doc_starz's,

In case you mean a polygonal number, the most computationally friendly method that we've found to determine if a number (a single number) is figurate is outlined in this post and explained a bit further in the subsequent posts:

Another non-filter approach to generating polygonal numbers

In case you mean "figurate" in the sense that is given in equation 3 of your link:

Figurate Number -- from Wolfram MathWorld

That would require a different algorithm, but probably one that we could write.

The term "figurate" can be used either way, and it's not clear which you mean.

~modest

In case you mean a polygonal number, the most computationally friendly method that we've found to determine if a number (a single number) is figurate is outlined in this post and explained a bit further in the subsequent posts:

Another non-filter approach to generating polygonal numbers

In case you mean "figurate" in the sense that is given in equation 3 of your link:

Figurate Number -- from Wolfram MathWorld

That would require a different algorithm, but probably one that we could write.

The term "figurate" can be used either way, and it's not clear which you mean.

~modest

### #5

Posted 17 June 2011 - 06:23 AM

About a year ago I posted an inquiry about deriving a polygonal (figurate) number backwards ;

This was the original post

http://scienceforums...rds/#post299124

I received excellent feedback from a number of people (thanks folks), and I realized I needed to clarify what I was after.

I've done that and I could use a hand and would appreciate feedback by all and any who feel inclined.

What Im after is a formula ( and or algorithm) , that I can take and then code, write into a program or script that will do the following ;

Any number from 1 to say 6 digits is input and then evaluated to see whether it qualifies as a polygonal number and if so how many sides it would have. Previously I said I wanted to determine if it was a figurate, but really I'm just after form symmetry here, and since figurates are polygonal, right now it doesn't matter to me whether a number is polygonal AND a centered figurate of some kind or similar. Really all I want to know is whether a given numeric value has form symmetry and regular edges...

But there's a bit of catch, I'm also wanting to evaluate 'graininess'... what do I mean by that? Basically, instead of just determining whether or not a given value is a specific fit for an exact polygonal number of x sides, I want to also find out for those numbers that are NOT proper exact polygonal numbers, what polygonal number they would be closest to...

Likely I'm looking at some kind of remainder value to be used as a unit measure for grain resolution. In other words say a given value of large magnitude, 6 digits is not a perfect triangular number but its closest to a value of a triangular number than any other polygon type and is over or under by a certain number which is calculated and displayed.

Don Blaze gave me some good direction with some of the formulas he displayed at the link (above), I'm getting the basic logic I think however I tried this particular formula and couldn't get it to work as is with a variety of inputs.

It DOES work if I use a square number like 25, and if I enter the values of 4 for 's' and 25 for n, his formula ;

\frac{\sqrt{8*n*(s-2)+(s-4)^2}+s-4}{2*(s-2)}

returns the value of 5, which divided into 25 does of course reveal the # of sides ; four, which is what I'm after

but I cant take any given value and feed it into the formula and get consistent results that are accurate, i.e. if I enter values for other polygonals I don't get the correct side #'s

Imagine you were looking at any of the values on this link ;

http://www.virtuesci...al-numbers.html

For example ;

Say we chose a nonagonal of 6069 or a hexagonal of 3160, or a pentagonal of 2882 as our single input value and we want our formula or algorithm to simply spit out the number of values as the resultant, so we'd get either a 9 a 6 or a 5

How would this formula look, function? I would honestly love and appreciate some help with this, and if I can see us arrive at a functioning routine I'm quite happy to share back the applet I code up for any who might find it helpful or meaningful

Once we get that wrapped, however here is the next step and its what I'm really after as the end result, being able to take any given number whether its a proper polygonal value or not and determining its closest fit or approximation to the polygonal number and providing a graininess gauge based on remainder values.

Here are some examples of simple smaller number ;

======================

4834

3726

4025

4747

4295

3363

Some larger numbers, note some numbers may have integer values to the fourth decimal position ;

147638.841

205996.772

116460.597

7063.928

188887.572

1100.391

======================

So any one of the above values constitute the ONLY input for the formula, algorithm, and the formula using fixed constants, operators, and similar then yields an output which is a numeric value that species the number of sides of the polygon that the number either fits exactly OR comes closest to fitting and in the case of the latter provides a remainder value as some sort of graininess factor.

This graininess factor is used to discerned the degree of form symmetry or asymmetry of the value.

Likely the question will come up, how far off can a value be from a given "closest match" polygonal number to qualify before the asymmetry makes the match meaningless? A logical range will have to be hard wired in so that for those values that are too far away from matching a given polygonal number return a null or some kind of flag to alert the code that no match is found. I'm open to suggestions here but Id like to have the option to make this programmtically adjustable so I can tweak and

tune and fiddle with this as an option I can calibrate. Obviously values that are too far away from a closest match will have to be classified as an asymmetric blob.

Why would I want to do this some may ask? Ok, my reason is a bit weird but I think many will find it interesting and warranted.

Im interested in population dynamics, specifically in simple marine organisms and other values found in natural systems.

One example of this is Verhultz Equations yielding cyclic waxing and waning values that are repetitive over time are one of the areas Im focusing on, see ;

http://maps.unomaha....4/verhultz.html

Ive corresponded over the years with Ray Tomes of ;

http://cyclesresearchinstitute.org/

http://ray.tomes.biz/maths.html

Id like to be able to capture values over time and compare the geometric fluctuations in the cycles themselves, Tomes seems to think that numeric values associated with dynamic, systemic change within a given natural system will reveal geometric relations - Id like to be able to experiment essentially with this.

If we can derive this function it will come in handy for comparative analysis.

Thanks folks for any help you can offer!

This was the original post

http://scienceforums...rds/#post299124

I received excellent feedback from a number of people (thanks folks), and I realized I needed to clarify what I was after.

I've done that and I could use a hand and would appreciate feedback by all and any who feel inclined.

What Im after is a formula ( and or algorithm) , that I can take and then code, write into a program or script that will do the following ;

Any number from 1 to say 6 digits is input and then evaluated to see whether it qualifies as a polygonal number and if so how many sides it would have. Previously I said I wanted to determine if it was a figurate, but really I'm just after form symmetry here, and since figurates are polygonal, right now it doesn't matter to me whether a number is polygonal AND a centered figurate of some kind or similar. Really all I want to know is whether a given numeric value has form symmetry and regular edges...

But there's a bit of catch, I'm also wanting to evaluate 'graininess'... what do I mean by that? Basically, instead of just determining whether or not a given value is a specific fit for an exact polygonal number of x sides, I want to also find out for those numbers that are NOT proper exact polygonal numbers, what polygonal number they would be closest to...

Likely I'm looking at some kind of remainder value to be used as a unit measure for grain resolution. In other words say a given value of large magnitude, 6 digits is not a perfect triangular number but its closest to a value of a triangular number than any other polygon type and is over or under by a certain number which is calculated and displayed.

Don Blaze gave me some good direction with some of the formulas he displayed at the link (above), I'm getting the basic logic I think however I tried this particular formula and couldn't get it to work as is with a variety of inputs.

It DOES work if I use a square number like 25, and if I enter the values of 4 for 's' and 25 for n, his formula ;

\frac{\sqrt{8*n*(s-2)+(s-4)^2}+s-4}{2*(s-2)}

returns the value of 5, which divided into 25 does of course reveal the # of sides ; four, which is what I'm after

but I cant take any given value and feed it into the formula and get consistent results that are accurate, i.e. if I enter values for other polygonals I don't get the correct side #'s

Imagine you were looking at any of the values on this link ;

http://www.virtuesci...al-numbers.html

For example ;

Say we chose a nonagonal of 6069 or a hexagonal of 3160, or a pentagonal of 2882 as our single input value and we want our formula or algorithm to simply spit out the number of values as the resultant, so we'd get either a 9 a 6 or a 5

How would this formula look, function? I would honestly love and appreciate some help with this, and if I can see us arrive at a functioning routine I'm quite happy to share back the applet I code up for any who might find it helpful or meaningful

Once we get that wrapped, however here is the next step and its what I'm really after as the end result, being able to take any given number whether its a proper polygonal value or not and determining its closest fit or approximation to the polygonal number and providing a graininess gauge based on remainder values.

Here are some examples of simple smaller number ;

======================

4834

3726

4025

4747

4295

3363

Some larger numbers, note some numbers may have integer values to the fourth decimal position ;

147638.841

205996.772

116460.597

7063.928

188887.572

1100.391

======================

So any one of the above values constitute the ONLY input for the formula, algorithm, and the formula using fixed constants, operators, and similar then yields an output which is a numeric value that species the number of sides of the polygon that the number either fits exactly OR comes closest to fitting and in the case of the latter provides a remainder value as some sort of graininess factor.

This graininess factor is used to discerned the degree of form symmetry or asymmetry of the value.

Likely the question will come up, how far off can a value be from a given "closest match" polygonal number to qualify before the asymmetry makes the match meaningless? A logical range will have to be hard wired in so that for those values that are too far away from matching a given polygonal number return a null or some kind of flag to alert the code that no match is found. I'm open to suggestions here but Id like to have the option to make this programmtically adjustable so I can tweak and

tune and fiddle with this as an option I can calibrate. Obviously values that are too far away from a closest match will have to be classified as an asymmetric blob.

Why would I want to do this some may ask? Ok, my reason is a bit weird but I think many will find it interesting and warranted.

Im interested in population dynamics, specifically in simple marine organisms and other values found in natural systems.

One example of this is Verhultz Equations yielding cyclic waxing and waning values that are repetitive over time are one of the areas Im focusing on, see ;

http://maps.unomaha....4/verhultz.html

Ive corresponded over the years with Ray Tomes of ;

http://cyclesresearchinstitute.org/

http://ray.tomes.biz/maths.html

Id like to be able to capture values over time and compare the geometric fluctuations in the cycles themselves, Tomes seems to think that numeric values associated with dynamic, systemic change within a given natural system will reveal geometric relations - Id like to be able to experiment essentially with this.

If we can derive this function it will come in handy for comparative analysis.

Thanks folks for any help you can offer!

### #6

Posted 17 June 2011 - 07:51 PM

unfortunately this is a bit like trying to factorize a number or say its prime, which is mathematically a "hard" (read exponential) problem.

if you only need up to 6 digit numbers, then this is no problem. simply construct an array of all the figurate numbers up to 1 million, then use that to compare any input value. if you need below 10 digits, this is slightly more difficult but still feasible. simply construct a large binary number, each bit representing whether or not a number is figurate. then once again, use that to determine how close you are. if you really REALLY insist on a formula, don blazys provided you with one.

here's an example of how you can use this formula.

let's say we want to know how close 4025 is to being figurate.

first, let's test how triangular it is.

(sqrt(8*4025 +1) -1)/2 = 89.223. so, 89*90/2 is aprox. 4025. (its acutally 4005.)

not bad. now let's test how square it is.

sqrt(4025) = 63.443. so 63^2 is aprox 4025. (its actually 3969)

now pentagonal.

(sqrt(8*4025*3 +1) +1)/6 = 51.968. so 3/2*52^2 +52/2 = 4082 is the closest pentagonal number.

and so on.

if you only need up to 6 digit numbers, then this is no problem. simply construct an array of all the figurate numbers up to 1 million, then use that to compare any input value. if you need below 10 digits, this is slightly more difficult but still feasible. simply construct a large binary number, each bit representing whether or not a number is figurate. then once again, use that to determine how close you are. if you really REALLY insist on a formula, don blazys provided you with one.

here's an example of how you can use this formula.

let's say we want to know how close 4025 is to being figurate.

first, let's test how triangular it is.

(sqrt(8*4025 +1) -1)/2 = 89.223. so, 89*90/2 is aprox. 4025. (its acutally 4005.)

not bad. now let's test how square it is.

sqrt(4025) = 63.443. so 63^2 is aprox 4025. (its actually 3969)

now pentagonal.

(sqrt(8*4025*3 +1) +1)/6 = 51.968. so 3/2*52^2 +52/2 = 4082 is the closest pentagonal number.

and so on.