Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 5th, 2007, 11:30 AM
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems already! KennySargent BOOK: Professional XNA Programming 2nd Edition ISBN: 978-0-470-26128-6 4 April 7th, 2008 03:36 AM
Have 2 problems so far... Soulcatcher BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 June 20th, 2007 12:57 PM
c problems saurabh1983in C++ Programming 6 November 29th, 2005 04:23 AM
validate.asp problems and logon.asp problems p2ptolu Classic ASP Databases 0 February 16th, 2005 02:34 PM
Problems kilika Javascript 1 October 3rd, 2003 02:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.