• Welcome to DNForum.com - Domain Investor Forum, Free Domain Marketplace and a community for 45+ domain pros
    If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the oldest global domain name community on the internet and continues to grow every day. There are over 45,000 domainers on DNForum doing everything from buying domains, selling domains, using our free in-house built tools, learning about domains and discussing domains. Take a minute and Register.

Hey Geniuses! Math problem...

Status
Not open for further replies.

Mr.Domains

DNF Addict
The Originals
Legacy Exclusive Member
Joined
Sep 29, 2004
Messages
1,417
Reaction score
29
Okay, I know there are some REALLY brainy people on here, and this kind of thing makes my brain ache, (I'm a programmer, but more on the creative side than with numbers).

I need an equation to generate a Math Pattern, (probably a fairly simple one, but not immediately recognizable like 2,4,6,8... or 10,20,30,40...).

I need a pattern that starts:

10, around (14-18), around (22-25), around (30-40), then onwards exponentially...
(It shouldn't be an immediately obvious pattern to joe average though...) :?:
 
I quite like this pattern, (I just can't work out what the formula is)... :blush:

1. 10
2. 14 (prev + 4)
3. 19 (prev + 5)
4. 25 (prev + 6)
5. 32 (prev + 7)
6. 40 (prev + 8)
7. 49 (prev + 9)
8. 59 (prev + 10)
8. 70 (prev + 11)
10. 82 (prev + 12)
11. 95 (prev + 13)
12. 109 (prev + 14)
 
Edit: never mind, Johnn beat me to it.

I was trying to do a proper mathematical function f(x) = something; but I couldn't get it, but if you are using a programming language
you should be able to implement Johnn's solution which was more elegant than mine.

Skinny
 
Hey,

I think it's a kind of recurrence, so it could be something like:
Code:
a[SUB]n+1 = [/SUB]a[SUB]n[/SUB] + k + n
init:
Code:
a[SUB]0 [/SUB]= 10
k = 4;

C snippet:
Code:
a = 10;
k = 4;
    
while( a < LIMIT )
    a += k++;
 
I think this is the formula NASA uses to plot proper angles on spacecraft re-entering earth's atmosphere.
 
Thanks Johnn, Skinny, vital, Gerry and asfas - you guys are great!

I didn't realize how bad my math sucks until I tried to use it for more than just straightforward multiplication or division ... still, it has been 20 years since I left school, :-P

I actually need it as an equation rather than a loop, because I need to be able to calculate what the Nth number would be, but another member (asfas) PM'ed me to say I could use:

y = (x*x + 5*x + 14) / 2

Looks about right, although I haven't tested it yet. Thanks for all your help!
 
You cannot produce multiple results with just one equation.
What are you trying to do with: Excel or programming.
Be specific and we should be able to come up with the solution.
 
Just don't try to divide by zero because your computer will explode.
 
It's called dynamic programming - you need previous results, but it's exactly what recurrences do.

Code:
a[SUB]0[/SUB] = 10, k = 4

a[SUB]1[/SUB] = a[SUB]0[/SUB] + k + 0 = 10 + 4 + 0 = 14
a[SUB]2[/SUB] = a[SUB]1[/SUB] + k + 1 = 14 + 4 + 1 = 19
a[SUB]3[/SUB] = a[SUB]2[/SUB] + k + 2 = 19 + 4 + 2 = 25
...
a[SUB]n+1 = [/SUB]a[SUB]n[/SUB] + k + n

The formula you posted is right, and code using the formula (y = (x*x + 5*x + 14) / 2)
produces sequence you wanted:
Code:
7
10
14
19
25
32
40
49
59
70
82
iterating x from 1 to 10.
 
You cannot produce multiple results with just one equation.

Of course you can, the result of "y" depends on "x", in this equation: y = (x*x + 5*x + 14) / 2

$x = 1; $y = 10;
$x = 2; $y = 14;

The formula you posted is right, and code using the formula produces sequence you wanted:

Cool, thanks!

Be specific and we should be able to come up with the solution.

I want to charge users an incrementing amount for upgrades, level 1 costs $10, level 2 costs $14, level 3 costs $19, and so on... ideally I'd even have the increments increase slightly more rapidly, (10, 16, 24-ish, etc if anyone cares to fine tune it), but this is close enough. Cheers!

(Unfortunately it's virtual credits, like forum $'s, not real cash!) :uhoh:
 
Last edited:
Status
Not open for further replies.
Back
Top Bottom