Click here to Skip to main content
11,578,524 members (59,964 online)

Algorithms

 
GeneralRe: Specify numbers as product of Primes? Pin
MarkBrock27-Jun-08 18:46
memberMarkBrock27-Jun-08 18:46 
GeneralRe: Specify numbers as product of Primes? Pin
Paul Conrad28-Jun-08 5:42
memberPaul Conrad28-Jun-08 5:42 
GeneralRe: Specify numbers as product of Primes? Pin
ChandraRam2-Jul-08 22:49
memberChandraRam2-Jul-08 22:49 
GeneralRe: Specify numbers as product of Primes? Pin
MarkBrock2-Jul-08 23:06
memberMarkBrock2-Jul-08 23:06 
AnswerRe: Specify numbers as product of Primes? Pin
Member 419459326-Jun-08 8:19
memberMember 419459326-Jun-08 8:19 
GeneralRe: Specify numbers as product of Primes? Pin
Robert.C.Cartaino26-Jun-08 8:47
memberRobert.C.Cartaino26-Jun-08 8:47 
GeneralRe: Specify numbers as product of Primes? Pin
Ian Uy26-Jun-08 17:51
memberIan Uy26-Jun-08 17:51 
GeneralRe: Specify numbers as product of Primes? Pin
cp987629-Jun-08 14:57
membercp987629-Jun-08 14:57 
AnswerRe: Specify numbers as product of Primes? Pin
Arash Partow29-Jun-08 0:48
memberArash Partow29-Jun-08 0:48 
GeneralRe: Specify numbers as product of Primes? [modified] Pin
cp987629-Jun-08 3:53
membercp987629-Jun-08 3:53 
GeneralRe: Specify numbers as product of Primes? Pin
Luc Pattyn29-Jun-08 4:40
mvpLuc Pattyn29-Jun-08 4:40 
GeneralRe: Specify numbers as product of Primes? Pin
cp987629-Jun-08 14:47
membercp987629-Jun-08 14:47 
GeneralRe: Specify numbers as product of Primes? Pin
Arash Partow30-Jun-08 2:54
memberArash Partow30-Jun-08 2:54 
GeneralRe: Specify numbers as product of Primes? Pin
cp987630-Jun-08 3:18
membercp987630-Jun-08 3:18 
Arash Partow wrote:
I believe this is not correct, assume you have an x composed from 2p where p is a prime, in this case it is clear that in certain circumstance sqrt(x) can be less than p (eg: 15838 = 7919 * 2, where 7919 > sqrt(15838)), for primal testing the sqrt(n) bound is ok, however its not suitable for the upper bound in this problem.


He's studying for the ACM competition - I don't want to spoon feed him! He can limit his testing to sqrt(N) but he has to modify his algorithm slightly for when InputCase is not 1 at the end.

In the example you give, he only needs to test until floor(sqrt(15838))=125, he will have only found 2 as a factor and InputCase will be 7919 after the 124 tests. He can then conclude the the remaining value in InputCase is the remaining prime factor. This is much more efficient than testing the remaining 15,703 factors.

Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

GeneralRe: Specify numbers as product of Primes? Pin
Arash Partow30-Jun-08 4:27
memberArash Partow30-Jun-08 4:27 
GeneralRe: Specify numbers as product of Primes? Pin
Arash Partow30-Jun-08 2:17
memberArash Partow30-Jun-08 2:17 
Questionlogic of prob function in ms excel Pin
sumit703425-Jun-08 0:40
membersumit703425-Jun-08 0:40 
QuestionFactorials Pin
Ian Uy24-Jun-08 8:17
memberIan Uy24-Jun-08 8:17 
AnswerRe: Factorials Pin
Tim Craig24-Jun-08 10:29
memberTim Craig24-Jun-08 10:29 
GeneralRe: Factorials Pin
Ian Uy25-Jun-08 6:32
memberIan Uy25-Jun-08 6:32 
GeneralRe: Factorials Pin
Tim Craig25-Jun-08 8:55
memberTim Craig25-Jun-08 8:55 
GeneralRe: Factorials Pin
Luc Pattyn25-Jun-08 11:01
mvpLuc Pattyn25-Jun-08 11:01 
GeneralRe: Factorials Pin
Tim Craig25-Jun-08 21:06
memberTim Craig25-Jun-08 21:06 
AnswerRe: Factorials Pin
cp987624-Jun-08 12:33
membercp987624-Jun-08 12:33 
AnswerRe: Factorials Pin
Matthew Butler24-Jun-08 12:38
memberMatthew Butler24-Jun-08 12:38 
GeneralRe: Factorials Pin
cp987624-Jun-08 14:05
membercp987624-Jun-08 14:05 
GeneralRe: Factorials Pin
Luc Pattyn24-Jun-08 15:02
mvpLuc Pattyn24-Jun-08 15:02 
GeneralRe: Factorials Pin
cp987624-Jun-08 20:09
membercp987624-Jun-08 20:09 
GeneralRe: Factorials Pin
Luc Pattyn24-Jun-08 23:53
mvpLuc Pattyn24-Jun-08 23:53 
GeneralRe: Factorials Pin
cp987625-Jun-08 2:27
membercp987625-Jun-08 2:27 
GeneralRe: Factorials Pin
Luc Pattyn25-Jun-08 2:34
mvpLuc Pattyn25-Jun-08 2:34 
GeneralRe: Factorials Pin
cp987625-Jun-08 2:40
membercp987625-Jun-08 2:40 
AnswerRe: Factorials Pin
tim_one14-Jul-08 8:37
membertim_one14-Jul-08 8:37 
AnswerRe: Factorials Pin
Arash Partow25-Jun-08 2:14
memberArash Partow25-Jun-08 2:14 
GeneralRe: Factorials Pin
Ian Uy25-Jun-08 6:26
memberIan Uy25-Jun-08 6:26 
QuestionHow to determine the next x,y coordinate for a tank in a 2-D game... Pin
Edmundisme18-Jun-08 8:35
memberEdmundisme18-Jun-08 8:35 
AnswerRe: How to determine the next x,y coordinate for a tank in a 2-D game... Pin
73Zeppelin18-Jun-08 11:38
member73Zeppelin18-Jun-08 11:38 
GeneralRe: How to determine the next x,y coordinate for a tank in a 2-D game... Pin
Matthew Butler18-Jun-08 11:44
memberMatthew Butler18-Jun-08 11:44 
GeneralRe: How to determine the next x,y coordinate for a tank in a 2-D game... Pin
73Zeppelin18-Jun-08 22:00
member73Zeppelin18-Jun-08 22:00 
GeneralRe: How to determine the next x,y coordinate for a tank in a 2-D game... Pin
Edmundisme18-Jun-08 12:00
memberEdmundisme18-Jun-08 12:00 
AnswerRe: How to determine the next x,y coordinate for a tank in a 2-D game... Pin
Matthew Butler18-Jun-08 11:41
memberMatthew Butler18-Jun-08 11:41 
GeneralRe: How to determine the next x,y coordinate for a tank in a 2-D game... Pin
Edmundisme18-Jun-08 12:01
memberEdmundisme18-Jun-08 12:01 
JokeRe: How to determine the next x,y coordinate for a tank in a 2-D game... Pin
CPallini18-Jun-08 21:19
mvpCPallini18-Jun-08 21:19 
QuestionPolyline offset algorithm Pin
beko16-Jun-08 21:59
memberbeko16-Jun-08 21:59 
AnswerRe: Polyline offset algorithm Pin
Alan Balkany17-Jun-08 4:07
memberAlan Balkany17-Jun-08 4:07 
GeneralRe: Polyline offset algorithm Pin
beko17-Jun-08 4:43
memberbeko17-Jun-08 4:43 
QuestionRe: Polyline offset algorithm Pin
CPallini17-Jun-08 7:03
mvp CPallini17-Jun-08 7:03 
AnswerRe: Polyline offset algorithm Pin
beko17-Jun-08 8:26
memberbeko17-Jun-08 8:26 
GeneralRe: Polyline offset algorithm Pin
cp987617-Jun-08 12:10
membercp987617-Jun-08 12:10 
AnswerRe: Polyline offset algorithm Pin
Arash Partow18-Jun-08 1:22
memberArash Partow18-Jun-08 1:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 3 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid