Click here to Skip to main content
15,885,127 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Factorials Pin
Tim Craig25-Jun-08 21:06
Tim Craig25-Jun-08 21:06 
AnswerRe: Factorials Pin
cp987624-Jun-08 12:33
cp987624-Jun-08 12:33 
AnswerRe: Factorials Pin
Matthew Butler24-Jun-08 12:38
Matthew Butler24-Jun-08 12:38 
GeneralRe: Factorials Pin
cp987624-Jun-08 14:05
cp987624-Jun-08 14:05 
GeneralRe: Factorials Pin
Luc Pattyn24-Jun-08 15:02
sitebuilderLuc Pattyn24-Jun-08 15:02 
GeneralRe: Factorials Pin
cp987624-Jun-08 20:09
cp987624-Jun-08 20:09 
GeneralRe: Factorials Pin
Luc Pattyn24-Jun-08 23:53
sitebuilderLuc Pattyn24-Jun-08 23:53 
GeneralRe: Factorials Pin
cp987625-Jun-08 2:27
cp987625-Jun-08 2:27 
Luc Pattyn wrote:
countN tells me how many factors of n! end on digit N


OK now I see what you are doing. I'm sure you have some very clever reason for this, but it is not clear to me why you do

count5 += count10;	
if (count5 != 0) 
   {
   result = (result * rightmostNonzeroInFactorial(count5)) % 10;
   count2 -= count5;
   }


and not what I would expect:

if (count5 != 0) 
   {
   result = (result * rightmostNonzeroInFactorial(count5)) % 10;
   count2 -= count5;
   }
if (count10 != 0) 
   {
   result = (result * rightmostNonzeroInFactorial(count10)) % 10;
   }


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: Factorials Pin
Luc Pattyn25-Jun-08 2:34
sitebuilderLuc Pattyn25-Jun-08 2:34 
GeneralRe: Factorials Pin
cp987625-Jun-08 2:40
cp987625-Jun-08 2:40 
AnswerRe: Factorials Pin
tim_one14-Jul-08 8:37
tim_one14-Jul-08 8:37 
AnswerRe: Factorials PinPopular
Arash Partow25-Jun-08 2:14
Arash Partow25-Jun-08 2:14 
GeneralRe: Factorials Pin
Ian Uy25-Jun-08 6:26
Ian 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
Edmundisme18-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
73Zeppelin18-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
Matthew 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
73Zeppelin18-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
Edmundisme18-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
Matthew 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
Edmundisme18-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
mveCPallini18-Jun-08 21:19 
QuestionPolyline offset algorithm Pin
beko16-Jun-08 21:59
beko16-Jun-08 21:59 
AnswerRe: Polyline offset algorithm Pin
Alan Balkany17-Jun-08 4:07
Alan Balkany17-Jun-08 4:07 
GeneralRe: Polyline offset algorithm Pin
beko17-Jun-08 4:43
beko17-Jun-08 4:43 
QuestionRe: Polyline offset algorithm Pin
CPallini17-Jun-08 7:03
mveCPallini17-Jun-08 7:03 

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

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