Search found 2 matches

by rob
Sat Aug 06, 2005 11:25 am
Forum: Volume 100 (10000-10099)
Topic: 10006 - Carmichael Numbers
Replies: 66
Views: 20621

Re: Plz Help me...

Hi!
J&Jewel wrote:Here is my code I do not understand why this out Wrong Ans:..Plz Help me.....
Maybe you should declare k near i (outside the while loop).

It's just an idea, so maybe work or maybe not.

rob
by rob
Sat Aug 06, 2005 10:27 am
Forum: Volume 100 (10000-10099)
Topic: 10006 - Carmichael Numbers
Replies: 66
Views: 20621

linear time

Hi Guys! Can anybody solve this problem in linear time? I only find this algorithm: prev_mod = 2%n; is_charmich = 0; for(a=2; a<n; a++){ prev_mod = a%n; for(i=1; i<n; i++){ prev_mod = (a*prev_mod)%n; } if(prev_mod != a){ is_charmich = 0; break; } if(a<sqrtn && !(n%a)){ is_charmich = 1; break; } } bu...

Go to advanced search