0% found this document useful (0 votes)
3 views

algorithm

The document outlines a step-by-step process for checking and displaying Prime-Adam numbers within a specified range. It includes defining functions to check for prime numbers, Adam numbers, and reversing numbers, along with input validation and result display. The final output will either list the Prime-Adam numbers found or indicate that none were found.

Uploaded by

Avra Ray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

algorithm

The document outlines a step-by-step process for checking and displaying Prime-Adam numbers within a specified range. It includes defining functions to check for prime numbers, Adam numbers, and reversing numbers, along with input validation and result display. The final output will either list the Prime-Adam numbers found or indicate that none were found.

Uploaded by

Avra Ray
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Step 1: Start

Step 2: Check for primes:

 Define a function isPrime(int n) to check if the the number is prime

 Returns true if the number has exactly two divisors (1 and itself).

Step 3: Check for Adam Number:

 Define a function isAdam(int n) to check if a number is an Adam number.

 An Adam number satisfies the condition that the square of the number,
when reversed, equals the square of its reverse.

Step 4: Reverse a Number (reverse method):

 Define a function reverse(int n) to reverse the number given by user.

Step 5: Main Functionality:

 Accepts a range of integers (m to n).

 Validates the input range (m > 0, n > 0, m < n).

 Iterates through the range, checking for numbers that are both prime and
Adam.

Step 6: Display the results:

 Displays the "Prime-Adam" numbers and their frequency, if found.

 If no prime adam integers are found, print NIL

Step 7: Stop
Variable Description Table:

You might also like