• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Help with a C++ program

C

Cookiexide

Guest
#1
Hey guys I need help with writing a program. I need to make a program that finds the integer from 1 to 1000 with the most divisors that produce no remainder. For example, the integer 60 has 12 divisors that produce no remainder.
They are 1,2,3,4,5,6,10,12,15,20,30,60.
Can anyone help? Thanks in advance!
 

Sazar

F@H - Is it in you?
Staff member
Political User
#2
Originally posted by Cookiexide
Hey guys I need help with writing a program. I need to make a program that finds the integer from 1 to 1000 with the most divisors that produce no remainder. For example, the integer 60 has 12 divisors that produce no remainder.
They are 1,2,3,4,5,6,10,12,15,20,30,60.
Can anyone help? Thanks in advance!
since I don't have a compiler on my system right now I will just try and give you the basics on what to do...

I don't know the extent of your coding knowledge so I will try and keep it as simple as possible...

first of my question would be do you have an input? or are you just compiling the proggy and once that is done it outputs the integers divisible with no remainder?

I would loop the proggy to do a from i <= 1000 do divide number (n or whatever you want to call it)... within that loop have error checking as in verify result.. so that if there is a decimal the value is thrown out, if not value is stored either in array or is output...

example of alogorithmic flow would be if val = certain criteria than cout (or store in array) else go to next i...

I mean there are a few ways to do this...

you are looking at a couple of loops and use of arrays seems to be a must to keep things nice and tidy...

sorry I was not more help :) extremely sleepy right now... in process of waking up...
 
#3
Do you deal with Pocket PCs?

If so, I am looking for a NEW Dell Axim X5 Advance (that's the one with the 400Mhz Processor). What kind of price can you offer on this?
 

Sazar

F@H - Is it in you?
Staff member
Political User
#4
Originally posted by Un4gIvEn1
Do you deal with Pocket PCs?

If so, I am looking for a NEW Dell Axim X5 Advance (that's the one with the 400Mhz Processor). What kind of price can you offer on this?
I would recommend that you look @ the thread before you start posting...

:)
 
#5
The number between 1 and 1000 that has the most divisors with no remainder? That's easy. :) It's 512 and 768.
The smallest divisor is 2. A number built up only by 2:s must be the smallest number with a specific number of divisors. 2^9 = 512. 9 divisors.
768 = 3*2^8. So that's also 9 divisors.
10 divisors, 2^10 = 1024 which is just to big.

No program needed. :)
 

Sazar

F@H - Is it in you?
Staff member
Political User
#6
Originally posted by Zedric
The number between 1 and 1000 that has the most divisors with no remainder? That's easy. :) It's 512 and 768.
The smallest divisor is 2. A number built up only by 2:s must be the smallest number with a specific number of divisors. 2^9 = 256. 9 divisors.
768 = 3*2^8. So that's also 9 divisors.
10 divisors, 2^10 = 1024 which is just to big.

No program needed. :)
lol... cardinal rule of programming... understanding the question before lurching into coding...

heh cheers zed :) teach me to be awake when I post...

:cool:
 

Members online

No members online now.

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,015
Latest member
sanoravies