Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 Re: Help Me ! » Permutation Generator » 2012-10-28 22:09:30

hey guys ,

I was trying to figure out how to write the code to generate a list for the following code.... let me know if you guys can help?

the question was pick 5 number 1-56 ( No repeats) and an extra number 1-52

#include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
int cnt = 0;
int x1,x2,x3,x4,x5,y;
for (x1=1;x1<57;x1++)
{
for (x2=x1+1;x2<57;x2++)
{
for (x3=x2+1;x3<57;x3++)
{
for (x4=x3+1;x4<57;x4++)
{
for (x5=x4+1;x5<57;x5++)
{
for (y=1;y<53;y++)
{
if (x1+x2+x3+x4+x5+y == 147)
{
cnt++;
}
}
}
}
}
}
}
printf("%d",cnt);
system("PAUSE");
return 0;
}

## #2 Re: Help Me ! » Permutation Generator » 2012-02-26 14:58:21

I mean instead of the list of 1,748,533 solutions on one single file, is it possible to put the soultions on multiple files?

## #3 Re: Help Me ! » Permutation Generator » 2012-02-26 07:49:46

Hi gAr and bobbym,

Sorry for such a late response.. After our last postings (post 22) I have been crammed with Finals, Papers, Projects and what not.... The project that you guys helped me on was a success , thanks again!...
.. I was wondering (just out of curiosity) since the file would be tremendously large to show all possible solutions, if there is an actual way to break up the solutions to accommodate the file size.

## #4 Re: Help Me ! » Permutation Generator » 2012-02-11 08:47:15

Thanks guys I appreciate it!

## #5 Re: Help Me ! » Permutation Generator » 2012-02-10 11:36:18

Hi bobym,

Whats your thought process behind the 42113?

## #6 Re: Help Me ! » Permutation Generator » 2012-02-09 16:13:12

Yes you got it!... Sorry for the confusion ... should have explained it better

## #7 Re: Help Me ! » Permutation Generator » 2012-02-09 02:27:58

Gar,

Yes order does not matter for the 5 number, but the magic number is at the end ....so technically order matters lol... let me know if this is confusing.......... the problem is like picking numbers for the lottery, for example: Mega Million,   and the numbers you pick have to add up to 147

## #8 Re: Help Me ! » Permutation Generator » 2012-02-08 15:56:33

Gar,

Yes in the fact that you only pick one magic number but may not be distinct from the other five numbers.......
magic#                                 magic#
random ex: 4 15 25 38 27      4     or   5   9  13  32   45       20

## #9 Re: Help Me ! » Permutation Generator » 2012-02-08 03:03:32

Hi gAr,

Yes sorry the 5 are distinct. No repeating numbers.

## #10 Help Me ! » Permutation Generator » 2012-02-07 16:19:32

aegiziano1
Replies: 40

Hey everyone! I was wondering if someone can help me out. I have a math project and need a little help:
problem:
You are to pick five numbers ranging from 1 to 56 and a magic number ranging from 1 to 52. What you have to do is come up with possible combination that have a sum totaling 147. How many combinations are there? What are the combinations?

I was wondering if can help me start the problem   ..... and is there a way to do this on excel or an online program I can use..