• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Mathmatics

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

deRusett

Member
Joined
Jul 30, 2002
Location
Midland, Ontario
Ok, I am working on a program, and have run into a Math Probelm



the Problem being I forgot my Highschool finite course.


you know the formulas that helped you figure out odds,


some number factoral over another number Factoral


there were 2 differnt ones, one a item could be repeated the other it couldn't, well I forget the funtions.


ALSO

a is there a generic formula

X* 10 = X1
X1 * 10 = X2
X2 * 10 = X3
....
Xn * 10 = Xn+1

so I can input saying I want 10 X's which would give a total of
X +X1 + X2....+X9

I'll probably figure this out tonight, but would like it if someone else who knows what they are talking about would chime in and save me doing things all wrong
 
you're thinking of permutations/combinations, if i am correct:

a permutation is an ordered selection of k from n (n>=k) without replacement:
n! / (n-k)!

a combination is an unordered selection of k from n (n>=k) without replacement:
n! / [(n-k)!(k!)]

for the second one i'm not really sure what you're asking..

but, if 10X = X1.... 10Xn = Xn+1

then X2= 10(10X) ....=> Xn+1 = 10^(n+1)X
 
Last edited:
BINGO,

you Nailed the first one thats exactly what I am looking for




But the second is my Mistake I supose


each number after X denotes a SUB number


I should have used Formatting to make them smaller.


Basically saying X as a Variable is different after each line


I want the formula to basically do
this


You need 10 points to move from level 1 to level 2
the number of pointed need to move from level 2 to level 3 is 20

X1 * 10 = X2
^ . . . . . . ^ level I am going to be on
|
level I am on


so I want to know the amount of points I need to make it from level 1 to level n,



is this a little more clear.


thank you for permutations/combinations, I knew one started with a P and the other with a C, but that was the extent of my memory
 
i took it as you need:
10X pts to move to level X1

and 10*X1 to move to level X2
(* meaning multiply)

So:
X2=10X1 and
X1=10X
by substitution:
X2=10(10(X)) or X2=100X


or one hundred points times X to move to level X3 ...

you can then prove by induction that (Xn) is (X)*(10^(n-1))

I did something like that my first month or so of discreet/algorithmic math, hence my response.


now from what you are saying you are actually adding the number of points...
so
10 to break level 1
20 to break level 2 (plus the 10 from level 1)
and then
30 to break 3 (plus the 20 from level 2, and the 10 from level 1)

and you want to know the total number of points from all the previous levels... correct?


if not, do you have the problem in a written form.. something you scan and post... ?
 
lol im taking grade 12 discreet math right now and it looks like
Proof by mathamatical induction
which is like you have the formula and prove case: n = 1
then assume n = k
then try and prove n = k+1 to prove the equation is always true.
where n and k and k+1 can be the number in a series.


there are also the choose and permutation buttons on a calculator so :
5 C 2 = 10, of 5 different objects 2 different objects can be selected 10 times
5 P 2 = 20, this is like choose only the order the numbers the selected matters so {1, 2} != {2, 1}
 
chaosfactor said:
i took it as you need:
10X pts to move to level X1

and 10*X1 to move to level X2
(* meaning multiply)

So:
X2=10X1 and
X1=10X
by substitution:
X2=10(10(X)) or X2=100X


or one hundred points times X to move to level X3



This is flawed since it requires only 30 points to move to level 3
10 (from level1 - level 2) + 20 ( from level 2- level 3) = 30



if not, do you have the problem in a written form.. something you scan and post... ?

Well since the problem is all in my head I have nothing writen or scanned

basically right now you can "buy" more levels 1 at a time,

$cost = $currentlevel * 10

so if I am at level 15 and I want to get to level 16 I pay 150


Now what I want to do to reduce strain on the SQL server is make it so you can buy multiple levels at a time, with out changing the costs


so if I was at level 15 and I wanted to get to level 20 that would be going up by 5 levels

buying one at a time it would cost 850

so I need to figure out how to make a forumla to allow this to be done.
 
Nebuchadnazzar said:


I knew about the buttons on the Calculator, but since I am writing a program I can't just use buttons :p I need to know the formulas

there are also the choose and permutation buttons on a calculator so :
5 C 2 = 10, of 5 different objects 2 different objects can be selected 10 times
5 P 2 = 20, this is like choose only the order the numbers the selected matters so {1, 2} != {2, 1}
 
I can't believe you made me do math, but here is my solution for your problem:

Point cost = 5n^2 - 5n where n is the level desired, or you could use (5n-5)(n) if the language you are using is light on math ability.

Now for the process for those who are interested:

You need:
(1*10) + (2*10) + (3*10) + ... + (n*10) = points needed (sort of, it should be n-1, but this is easier to see).

Factor out the 10, and we get
10 * (1+2+3+ ... + n) (look familiar yet?)
Substitute (n*(n+1))/2 for the sum, and we get
(10*(n*(n+1)))/2 and then simplify to get

5n * (n + 1), but this gives us the sum if we include the level we are going to, so substitute n=n-1 to get
5(n-1)((n-1)-1) and simplify again
(5n-5)(n) and then distribute to get
5n^2 - 5n

Now, if someone wants to do an inductive proof on the above forumula, they are welcome to it.
 
Oops, forgot to account for the level the user is at.

The formula should be (5n^2-5n) - (5k^2-5k) where n is the desired level, and k is the current level.
 
This is a very simple c++ program to demonstrate the above forumla in action. Of course, from reading your messages on this problem, I assume the current level will come from a database. You would probably also want to make sure the new level is greater than the current level.

Code:
#include <iostream>

int levelcost(int);

using namespace std;

int main()
{
  int current;
  int desired;

  cout << "Enter your current level:\n";
  cin >> current; 
  cout << "Enter your desired level:\n";
  cin >> desired;

  cout << "It will cost you " << levelcost(desired)-levelcost(current) << " points\n";

  return 0;
}

int levelcost(int n)
{
  return 5*((n * n) - n);
}
 
Back