Exercises Related to Math

Programming Questions

1. Factorial Calculator

Create two factorial calculator programs.

Solution Code (Link)

2. Factor Finder

Given an integer input greater than 0 (Assume that your input is greater than 0), print all its factors.

Solution Code (Link)

3. Prime Number Checker

Given an integer input greater than 1, determine if the inputted integer is a prime number.

Solution Code (Link)

4. Perfect Numbers

The proper divisors of a number are the factors of a number that is not equal to itself.

Example β†’ 12 has the proper divisors of: 1, 2, 3, 4, 6.

A perfect number is defined when the sum of a number’s proper divisors equal to the number itself.

Find the total sum of perfect numbers under 10,000.

Solution Code (Link)

5. The Most Number of Factors

From 1 to N, where N is an integer greater one. We will output the number between [1,N] that has the most factors.

Example: From numbers 1 to 5. β†’ The number 4 has the most factors.

Solution Code (Link)

6. Create an Nth Fibonacci number finder

Given an integer input of N greater than -1, create a program that outputs the Nth Fibonacci number.

Example.

  • 0th Fibonacci number is 0

  • 1st Fibonnaci number is 1

  • 10th is 55

  • 19th is 4181

Solution Code (Link)

Last updated