Thread: problems
View Single Post
  #1 (permalink)  
Old October 5th, 2007, 11:30 AM
baku baku is offline
Registered User
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default problems

Write and test a subalgorithm that solved the problem below.

1. Generate the first prime number larger than a given natural number n.

2. Determine the age of a person, in number of days.

3. Determine a calendar data (as year, month, day) starting from two integer numbers representing the year and the day number inside that year.

4. Given the natural number n, determine the prime numbers p1 and p2 such that
                     n = p1 + p2
    (check the hypothesis of Goldbach).

5. Determine the twin prime numbers p1 and p2 immediately larger than the given non-null natural number n. Two prime numbers p and q are called twin if q-p = 2.

6. Find the smallest number m from the Fibonacci sequence, defined by
           f[0]=f[1]=1, f[n]=f[n-1]+f[n-2], for n>2, larger than the given natural number n. So, find k and m such that f[k]=m, m>n and f[k-1] <=n.

7. Consider a given natural number n. Determine the product p of all the proper factors of n.

8. For a given natural number n find the minimal natural number m formed with the same digits. E.g. n=3658, m=3568.

9. The palindrome of a number is the number obtained by reversing the order of digits. E.g. palindrome (237) = 732). For a given natural number n, determine its palindrome.

10. For a given natural number n find the largest natural number written with the same digits. E.g. n=3658, m=8653.

11. The numbers n1 and n2 have the property P if their writings in basis 10 have the same digits (e.g. 2113 and 323121). Determine whether two given natural numbers have the property P.

12. Determine the n-th element of the sequence
                 1,2,3,2,5,2,3,7,2,3,2,5,...
obtained from the sequence of natural numbers by replacing composed numbers with their prime divisors, without memorizing the elements of the sequence.

13. Determine the n-th element of the sequence
                 1,2,3,2,2,5,2,2,3,3,3,7,2,2,3,3,3,...
obtained from the sequence of natural numbers by replacing composed numbers with their prime divisors, each divisor d being written d times, without memorizing the elements of the sequence.
14. Generate the smallest perfect number larger than a given natural number n. If such a number does not exist, a message should be displayed. A number is perfect if it is equal to the sum of its divisors, except itself. E.g. 6 is a perfect number (6=1+2+3).

15. Generate the larges prime number smaller than a given natural number n. If such a number does not exist, a message should be displayed.

16. Generate the largest perfect number smallest than a given natural number n. If such a number does not exist, a message should be displayed. A number is perfect if it is equal to the sum of its divisors, except itself. E.g. 6 is a perfect number (6=1+2+3).

respect for the ones who can make them!

Reply With Quote