Hamming numbers are numbers of the form . Hamming numbers are also known as ugly numbers and also 5-smooth numbers (numbers whose prime divisors are less or equal to […]

Continue Reading## C++: Rational Number Arithmetic

The objective of this task is to create a reasonably complete implementation of rational arithmetic in the particular language using the idioms of the language. For example: Define a new […]

Continue Reading## C++: Generate Random Number in Range

int random_in_range(int a, int b) //Function that returns a random integer between 2 provided integers { return a + random() % (b-a+1); }

Continue Reading## C++: Guess the Number With Feedback

The task is to write a game that follows the following rules: The computer will choose a number between given set limits and asks the player for repeated guesses until […]

Continue Reading## C++: Fibonacci N-Step Number Sequences

These number series are an expansion of the ordinary Fibonacci sequence where: For n = 2 we have the Fibonacci sequence; with initial values [1,1] and For n = 3 […]

Continue Reading## C++: Linear Congruential Generator

The linear congruential generator is a very simple example of a random number generator. All linear congruential generators use this formula: Where: r0 is a seed. r1, r2, r3, …, […]

Continue Reading## C++: Construct from Rational Number

To understand this task in context please see Continued fraction arithmetic The purpose of this task is to write a function r2cf(int N1,int N2), or r2cf(Fraction N), which will output […]

Continue Reading## C++: Guess the Number With Feedback (Vs Player)

The task is to write a player for the game that follows the following rules: The scorer will choose a number between set limits. The computer player will print a […]

Continue Reading## C++: Complex Number Arithmetic

A complex number is a number which can be written as “” (sometimes shown as ““) where a and b are real numbers and i is the square root of […]

Continue Reading## C++: Ludic Numbers

Ludic numbers are related to prime numbers as they are generated by a sieve quite like the Sieve of Eratosthenes is used to generate prime numbers. The first ludic number […]

Continue Reading