Page 1 of 3
Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:10 pm
by wub
Ok, maths problem.
I need to divide a certain number of objects into groups. Each object must remain whole. Each group can be either 2 or 3 objects. Total number of groups must be divisable by 4.
Is there a formula for calculating this based on a variation in the number of objects?
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:13 pm
by particle-jim
I'm proper shit at maths, not that that's of any use to you
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:14 pm
by wub
It's of some use to you, that's the main thing.
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:16 pm
by Forum
log rhythms
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:17 pm
by wub
That means nothing to me.
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:18 pm
by particle-jim
I think he's asking how frequently you poo
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:19 pm
by Forum
divide the groups by hypotenuse and add the pyathagoras. That should give you the isoceles
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:20 pm
by wub
Fuck off

Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:21 pm
by Electric_Head
southstar wrote:divide the groups by hypotenuse and add the pyathagoras. That should give you the isoceles
Surely you mean divide the rectangle by 2?
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:26 pm
by AxeD
Holy shit, you have to apply knowledge of formulas to real life.
Whatever job that is, back out now.
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:30 pm
by volcanogeorge
wub wrote:Ok, maths problem.
I need to divide a certain number of objects into groups. Each object must remain whole. Each group can be either 2 or 3 objects. Total number of groups must be divisable by 4.
Is there a formula for calculating this based on a variation in the number of objects?
what exactly would you need this formula to spit out?
you give it a number of objects and it spits out a number of groups of 2 and a number of groups of 3?
this would be pretty complex cos it could have multiple combinations of outputs that achieve the same result, unless you were to look for say the least number of total groups
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:31 pm
by wub
volcanogeorge wrote:wub wrote:Ok, maths problem.
I need to divide a certain number of objects into groups. Each object must remain whole. Each group can be either 2 or 3 objects. Total number of groups must be divisable by 4.
Is there a formula for calculating this based on a variation in the number of objects?
what exactly would you need this formula to spit out?
you give it a number of objects and it spits out a number of groups of 2 and a number of groups of 3?
Pretty much, yeah.
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:40 pm
by volcanogeorge
wub wrote:volcanogeorge wrote:wub wrote:Ok, maths problem.
I need to divide a certain number of objects into groups. Each object must remain whole. Each group can be either 2 or 3 objects. Total number of groups must be divisable by 4.
Is there a formula for calculating this based on a variation in the number of objects?
what exactly would you need this formula to spit out?
you give it a number of objects and it spits out a number of groups of 2 and a number of groups of 3?
Pretty much, yeah.
right i can think of a way of doing this but it'd involve a bit of head scratching and a fair amount of MATLAB code to work
short answer: there's probably not a simple formula that will do it for you but there is a sequence of steps to follow (which for a large number of objects you'd need to get a computer to perform) which will give you all possible answers
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:41 pm
by wub
If you could point me at some of the steps I'm happy to have a go myself

Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:48 pm
by volcanogeorge
right if you're dodgy on any of the terminology i'm using here then gimme a shout because i tend to think in terms of how i'd go about it in MATLAB:
1) Have the program break down the number of objects into all possible combinations of number pairs that will add together to total your number of objects. Store this as an array or a matrix
2) Search the matrix or array for combinations of numbers where one can be divided by 2 and the other by 3 (this is probably several steps in one
3) Divide each number by its respective multiple and store this as a separate array or matrix
4) Add the pairs of numbers in this new matrix together and store as a THIRD matrix with a single column
5) Search the third matrix for numbers which can be divided by 4 and store the row numbers that these are in
6) Spit out the relevant rows of the second matrix based on these row numbers
i'll clarify this later, gotta go see Taken 2
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 12:49 pm
by slothrop
I can see how to write an algorithm to do it, but it's not obvious that there's a closed form expression for the result...
Algorithm:
you have N objects
if N is divisible by 3, set a = N/3, b=0
is N-2 is divisible by 3, set a = (N-2)/3, b=1
if N-4 is divisible by 3, set a = (N-4)/3, b = 2
(one of these three will always be the case, since the remainder when N is divided by 3 will always be 0, 1 or 2)
If a+b is divisible by 4, job done, crack a beer. Otherwise, set
a = a-2
b = b+3
If a+b is divisible by 4, job done, crack a beer. Otherwise carry on in the same vein until it is.
a is the number of groups of 3, b is the number of groups of 2.
There are going to be a small number of N (mostly small) for which this doesn't work, in which case you're screwed. But this should get the answer for every N where there is a possible partition. (Edit ie any N>7.)
That's how I'd do it in code, you might be able to find a shorter version for doing it on paper...
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 1:08 pm
by ItsSpire
How many objects are you looking at? and if there is one group of two does it mean the other groups have to be groups of two?
You could divide the number of objects by 8 which leaves x amount of groups of 8. This could be split up into 4 groups of 2. The total number of groups would be x times 4 which means its divisible by 4.
for example you have 72 objects.
Divide this by 8 and you get 9.
You have 9 groups of 8.
Divide these groups of 8 into 4 smaller groups (the final groups, 2, 2, 2, 2)
you have 4 groups of 2 for every group of 8.
This totals up to 36 groups of 2 which is divisible by 4.
You could apply this same technique but instead divide by 9, 10, 11, 12 and it would work.
for example you have 154 objects.
Divide this by 11 and you get 14.
You have 14 groups of 11.
Divide these groups of 9 into 4 smaller groups (2, 3, 3, 3)
you have 4 groups every group of 8.
This totals up to 44 groups which is divisible by 4.
Sorry if im unclear, its abit hard to explain my thoughts without a piece off paper to draw the equations on

You could give me the numbers and i would be glad to work it out for ya, im definitaly a number ninja so ill find it fun
i think you could use logarithms do it but explaining that could take a while

Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 1:10 pm
by wub
Number of objects is a variable.
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 1:14 pm
by ItsSpire
but any idea of how many youll be getting, roughly. Is it in the hundreds?
Re: Maths problem - number Ninjas needed!
Posted: Wed Oct 10, 2012 1:18 pm
by garethom