Exercises Related to Math

Programming Questions

1. Factorial Calculator

Create two factorial calculator programs.

Solution Code (Linkarrow-up-right)

2. Factor Finder

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

Solution Code (Linkarrow-up-right)

3. Prime Number Checker

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

Solution Code (Linkarrow-up-right)

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 (Linkarrow-up-right)

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 (Linkarrow-up-right)

6. Create an Nth Fibonacci numberarrow-up-right 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 (Linkarrow-up-right)

Last updated