## Programming Challenge #1 — Primes

Code difficulty: 3/10
Math difficulty: 4/10

In this challenge I ask that you do the following things:

Create a program that will:

1. Allow a user to input a number
2. Allow the user to see if the number is prime or not
3. If the number is not prime, tell the user what number it is divisible by
4. Use a function to process whether or not the value is prime (this idea will be used in a future challenge
5. Use double or Long for increased number length

Concepts used: Functions, variables, loops, arithmatic functions, breaks, boolean

You should be able to do this by: Lesson 33

My solution: http://ideone.com/AKmCm (spoilers- Don’t look unless you are really stuck!)

Please note that my solutions are not checked thoroughly, and should only be used for reference. They are often non-optimal solutions that could be improved upon (by you!). I keep these intentionally rough for just that reason.

## Programming Challenge #2 – Dual Primes

Code difficulty: 4/10
Math difficulty: 4/10

Before we begin here: Q. What is a dual prime?
A. A dual prime is 2 prime numbers that are exactly “2” apart. Example: 3, 5 // 11,13, etc.

In his challenge I ask that you do the following things:

Create a program that will:

1. Allow a user to input a number to iterate up to
2. Allow the user to see all the dual primes, and a list of the numbers that are NOT dual prime
3. Use either a vector or a list and their inherent member functions to handle the data from the loop

Concepts used: Functions, variables, loops, arithmatic functions, breaks, boolean, vectors (or lists), template class member functions

You should be able to do this by: Lesson 44

My solution: http://ideone.com/Y7wiJ (spoilers- Don’t look unless you are really stuck!)

Please note that my solutions are not checked thoroughly, and should only be used for reference. They are often non-optimal solutions that could be improved upon (by you!). I keep these intentionally rough for just that reason.

## Programming Challenge #3 – Palindromic numbers

Code difficulty: 5/10
Math difficulty: 4/10

Before we begin here: Q. What is a palindrome?
A. A Palindrome is a number that is repeated both backwards and forwards

In his challenge I ask that you do the following things:

Create a program that will:

1. Iterate up to 1 million (1,000,000 or 1.000.000 for those of you that use . instead of ,)
2. Check each number to see if it is a palindrome
3. Count how many palindromes there are between 1 and 1 million, count how many of these palindromes are prime
4. Store each number that is both a palindrome and a prime number and output them at the end of the loop
5. Program to try to reduce runtime efficiency (hint: Your prime loop will likely take the most resources)

Concepts used: Functions, variables, loops, arithmatic functions, breaks, boolean, vectors (or lists), template class member functions

You should be able to do this by: Lesson 44 with some help from this example

My solution: http://ideone.com/Y6n0f
Note This solution has been reduced to 1000, you can change the number in the loop.
Note: This solution contains spoilers.

Please note that my solutions are not checked thoroughly, and should only be used for reference. They are often non-optimal solutions that could be improved upon (by you!). I keep these intentionally rough for just that reason.

## Programming Challenge #4 – Guessing game

Code difficulty: 4/10
Math difficulty: 2/10
In his challenge I ask that you do the following things:

Create a program that will:

1. Display a list of numbers to the screen (random numbers).
2. Pick one of those numbers at random and start a guessing game
3. The user must guess the selected number. You must validate that the number the user guessed was valid, and among the choices listed.
4. Tell the user whether or not the number they guessed is larger or smaller than the number you’re looking for.
5. After a certain number of guesses, the user loses and gets prompted to try again.

Concepts used: Functions, variables, loops, random functions, returns, boolean, vectors / lists / arrays, template class member functions, stringstream

You should be able to do this by: Lesson 40

My solution: Not completed yet
Note: This solution contains spoilers.

Please note that my solutions are not checked thoroughly, and should only be used for reference. They are often non-optimal solutions that could be improved upon (by you!). I keep these intentionally rough for just that reason.