Mathematics and number based challenges

The programming ideas/challenges featured here can be programmed in popular programming languages like C, C++, C#, Java, Go, Python, Ruby, JavaScript and PHP for either the Web, MacOS, Windows PC, Android, Windows Phone or iOS. Just fire up your favourite IDE, begin work on any of the program/projects featured here.

1. Distance Between Two Cities

Difficulty Beginner
Description Develop a program that calculates the distance between two cities and allows the user to specify a unit of distance. This program may require finding coordinates for the cities like latitude and longitude.

2. Tax Calculator

Difficulty Beginner
Description Develop a program that asks the user to enter a cost and either a country or state tax. It then returns the tax plus the total cost with tax.

3. Factorial Finder

Difficulty Beginner
Description The Factorial of a positive integer, n, is defined as the product of the sequence n, n-1, n-2, ...1. Also the factorial of zero, 0, is defined as being 1. Develop a program that solves the factorial of any user given number using both loops and recursion.

4. Happy Numbers

Difficulty Beginner
Description A happy number is defined by the following process. Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers. Find the first 8 happy numbers.

5. Coin Flip Simulation

Difficulty Beginner
Description Write some code that simulates flipping a single coin however many times the user decides. The code should record the outcomes and count the number of tails and heads.

6. Household Budget Program

Difficulty Expert
Description Create a full GUI program that allows the user to enter in and setup a household
budget. They can enter in unlimited number of budget categories like Utilities, Travel Expenses,or Child Care. Then let the user enter in X number of sub-items for each of these categories listing their monthly expenses along with any income items. Have the program keep track of their expenses and their cash flow. This program should let the user know if they are overspending or how much they are saving for the month or year.

7. Calculator

Difficulty Intermediate
Description A simple calculator to do basic operations. Make it a scientific calculator for added complexity.

8. Decimal to Roman Numerals

Difficulty Intermediate
Description Have the user enter in a simple integer value and it will print the Roman numeral
representation of that number.

9. Find Pi to the Nth Digit

Difficulty Beginner
Description Develop a program that has the user enter a number. Your program should print out Pi up to that many decimal places. Try to keep a limit as to how far the program will go.

10. Find e to the Nth Digit

Difficulty Beginner
Description Develop a program that has the user enter a number. Your program should then print out 'e' up to that many decimal places. Keep a limit as to how far the program will go.

11. Fibonacci Sequence

Difficulty Beginner
Description Develop a program that has the user enter a number. Your program should print out the Fibonacci sequence to that number or to the Nth number.

12. Prime Factorization

Difficulty Beginner
Description Develop a program that has the user enter a number and find all the Prime Factors (if there are any) and display them.

13. Next Prime Number

Difficulty Beginner
Description Develop a program that starting at any number the user inputs, generates the next prime number. Ask the user for confirmation to keep going, if it is granted print the next prime number again otherwise quit the program.

14. Mortgage Calculator

Difficulty Intermediate
Description Develop a program that calculate the monthly payments of a fixed term mortgage over given Nth terms at a given interest rate. Also, figure out how long it will take the user to pay back the loan. For added complexity, add an option for users to select the compounding interval (Monthly, Weekly, Daily, Continually).

15. Change Return Program

Difficulty Beginner
Description Develop a program that has the user enter the cost of an item and then the amount the user paid for the item. Your program should figure out the change and the number of quarters, dimes, nickels, pennies needed for the change.

16. Binary to Decimal and Back Converter

Difficulty Intermediate
Description Develop a program that converts a decimal number to binary or a binary number to its decimal equivalent. For added complexity, try adding converters to Octals and Hexadecimals too.

17. Alarm Clock

Difficulty Intermediate
Description Develop a simple alarm clock that plays a sound after X number of minutes/seconds or at a particular time. For added complexity, add the ability to add sticky notes and a date to the alarm.

18. Unit Converter

Difficulty Beginner
Description Develop a program that converts various units between one another. The user enters the type of unit being entered, the type of unit they want to convert to and then the value. The program will then make the conversion.

19. Least/Greatest Common Denominator

Difficulty Beginner
Description Create a program that asks the user to enter two fractions. Have the program find the least common or the greatest common denominator between those two fractions and print it out.

20. Kaprekar numbers

Difficulty Intermediate
Description In mathematics, a Kaprekar number for a given base is a non-negative integer, the representation of whose square in that base can be split into two parts that add up to the original number again. For instance, 45 is a Kaprekar number, because 45^2 = 2025 and 20+25 = 45. The Kaprekar numbers are named after D. R. Kaprekar. Your program will receive two integers per line telling you the start and end of the range to scan, inclusively. Example: '1 50'. Your program should emit the Kaprekar numbers in that range. From the example: 45 is the Kaprekar number in that range. For your program focus only on base 10 numbers. For added complexity, see if you can make it work in arbitrary bases.

21. Guess the Number

Difficulty Intermediate
Description Your program asks the user to guess and number and keep it in their head. It then asks the user to input a range that would dictates the maximum and minimun range your program should guess the number from. If your program guesses too high or too low, the user should be able to input "too high" or "too low" to notify you to fix your guess.

22. Find the N-th Natural Number

Difficulty Intermediate
Description The task is to find which natural number (or rather a digit between 0-9) is at the 1986th position. The number range is from 1 to 1000.

Optionally find the number that the 0-9 digit is a part of.

Example:

Given number range from 1-20 (1234567891011121314151617181920) the digit at position 17 would be '3' and it is a part of number '13'.

23. Neon Number

Difficulty Intermediate
Description A number is said to be a Neon Number if the sum of digits of the square of the number is equal to thenumber itself. Example- 9 is a Neon Number. 9*9=81 and 8+1=9.Hence it is a Neon Number.
The user is prompted to input a range eg 1-90. Your program should print out the neon numbers in that range.

24. Hardy-Ramanujan Number

Difficulty Intermediate
Description 1729 is a Hardy-Ramanujan number. It is the smallest number representable in two ways as a sum of two cubes.

1729 = 12^3 + 1^3
Also, 1729 = 10^3+9^3

Your program should generate all numbers between 1 and n that can be expressed as the sum of two cubes in two or more ways.

Discussion

Read Community Guidelines
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.