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

Algorithms

 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 4:14
Member 110631236-Sep-14 4:14 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 4:18
Member 110631236-Sep-14 4:18 
GeneralRe: Algorithm to find a given number is prime or not. Pin
harold aptroot6-Sep-14 4:49
harold aptroot6-Sep-14 4:49 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 6:33
Member 110631236-Sep-14 6:33 
GeneralRe: Algorithm to find a given number is prime or not. Pin
harold aptroot6-Sep-14 7:22
harold aptroot6-Sep-14 7:22 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631236-Sep-14 7:53
Member 110631236-Sep-14 7:53 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631237-Sep-14 6:23
Member 110631237-Sep-14 6:23 
GeneralRe: Algorithm to find a given number is prime or not. Pin
Member 110631237-Sep-14 6:23
Member 110631237-Sep-14 6:23 
the algorithm in plain english is
(0) initially set i=2 and flag=1
(1) take a number (num) which we want to test for being prime.
(2) Then we start dividing the number num successively by i= 2, 3, 4.....upto (num-1) and check for the reminder. At each iteration we increase i by 1.
(3) At any stage, if we find that num is divisible by i then (num is not prime) set flag=0
(4) If we reach i= (num-1) and still reminder is never 0 at any stage, then flag value remains unchanged at 1 and the number is prime

We test the flag value at the end of the program to decide whether num is prime or not.
AnswerRe: Algorithm to find a given number is prime or not. Pin
Richard MacCutchan6-Sep-14 5:06
mveRichard MacCutchan6-Sep-14 5:06 
AnswerRe: Algorithm to find a given number is prime or not. Pin
PIEBALDconsult14-Nov-14 3:37
mvePIEBALDconsult14-Nov-14 3:37 
QuestionHow to describe method: SQL for frequent pattern discovery Pin
pseudogrammaton4-Sep-14 18:01
pseudogrammaton4-Sep-14 18:01 
AnswerRe: How to describe method: SQL for frequent pattern discovery Pin
Bernhard Hiller4-Sep-14 20:52
Bernhard Hiller4-Sep-14 20:52 
GeneralRe: How to describe method: SQL for frequent pattern discovery Pin
pseudogrammaton5-Sep-14 2:55
pseudogrammaton5-Sep-14 2:55 
QuestionBoundless Binary Search Pin
Igor van den Hoven27-Aug-14 10:24
Igor van den Hoven27-Aug-14 10:24 
GeneralRe: Boundless Binary Search Pin
harold aptroot4-Sep-14 21:28
harold aptroot4-Sep-14 21:28 
GeneralRe: Boundless Binary Search Pin
Igor van den Hoven6-Sep-14 10:04
Igor van den Hoven6-Sep-14 10:04 
GeneralRe: Boundless Binary Search Pin
harold aptroot6-Sep-14 11:10
harold aptroot6-Sep-14 11:10 
GeneralRe: Boundless Binary Search Pin
Igor van den Hoven6-Sep-14 12:32
Igor van den Hoven6-Sep-14 12:32 
GeneralRe: Boundless Binary Search Pin
harold aptroot6-Sep-14 12:52
harold aptroot6-Sep-14 12:52 
GeneralRe: Boundless Binary Search Pin
Igor van den Hoven6-Sep-14 15:07
Igor van den Hoven6-Sep-14 15:07 
GeneralRe: Boundless Binary Search Pin
harold aptroot6-Sep-14 20:25
harold aptroot6-Sep-14 20:25 
AnswerRe: Boundless Binary Search Pin
Alan Balkany5-Nov-15 0:21
Alan Balkany5-Nov-15 0:21 
QuestionSurface calculation (sphere) - projection effect. [SOLVED ?] Pin
V.3-Aug-14 22:31
professionalV.3-Aug-14 22:31 
AnswerRe: Surface calculation (sphere) - projection effect. [SOLVED ?] Pin
Supreme Master27-Jul-15 9:24
Supreme Master27-Jul-15 9:24 
QuestionLock free algorithms Pin
Joe Woodbury1-Jul-14 8:15
professionalJoe Woodbury1-Jul-14 8:15 

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.