Algorithm to find out whether an input is a prime number or not

Click For Summary
An algorithm to determine if an input is a prime number involves checking divisibility by all integers up to the square root of the input. For computing the square root using Newton's method, an iterative approach is utilized to refine guesses until convergence. To identify if a number is perfect, the algorithm sums its divisors and compares the sum to the original number. Participants emphasize the importance of sharing initial attempts before seeking assistance. Providing a clear outline of efforts can facilitate more effective guidance.
hadi amiri 4
Messages
98
Reaction score
1

Homework Statement



1- write an algorithm to find out whether an input is a prime number
or not.
2-write aa program to compute square root by Newton method
3-write an algorithm to show an input is perfect or not.
4-

Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org


hadi amiri 4 said:

Homework Statement



1- write an algorithm to find out whether an input is a prime number
or not.
2-write aa program to compute square root by Newton method
3-write an algorithm to show an input is perfect or not.
4-

Homework Equations





The Attempt at a Solution

Before getting any help on this forum, you need to show what you have tried to do.
 

Similar threads

Replies
33
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
14
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 1 ·
Replies
1
Views
1K