Jump to content

Can find the right piece of code for the job.

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Ascension

Ascension

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
Hi guys,

This is a tough one. Basically what I want my program to do is work out ALL the combinations of numbers possible with the numbers 1 - 45 when you can pick a group of six numbers.

Eg.

1,2,3,4,5,6. 1,2,3,4,5,7. 1,2,3,4,5,6,8.

I have already done some calculations and found that the number of combinations is 8,145,060.

Basically what I want to do it write a program that calculates all combinations and streams them onto a text document. I want this to be done effectively and take as least time possible when it is executed. This is not top priority but I would like it to be one of my goals. My main objective though is to have the final text document with all the combinations on them.

I am really struggling to work out what statements I should use to complete this task as well as what language would be the best for such a task. I know a bit of C# and PHP. Please help.
:)

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Almost any language can do this, as long as it can write to a text file.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Ascension

Ascension

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
Yeah. My problem is thinking of what statement I would use to actually find all the combinations.

#4
mirwanda

mirwanda

    Learning Programmer

  • Members
  • PipPipPip
  • 31 posts
for speed, C/C++ is the best, use looping.
if you have a good server, use PHP.

#5
Ascension

Ascension

    Learning Programmer

  • Members
  • PipPipPip
  • 42 posts
No you don't understand. I know what language i'm going to do it in I just don't know what actual statement I would use to actually find the combinations.

#6
JCoder

JCoder

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 245 posts
Recursion.