The Hofstadter Q sequence is defined as: It is defined like the Fibonacci sequence, but whereas the next term in the Fibonacci sequence is th
Continue ReadingC++: Currying
Create a simple demonstrative example of Currying in the specific language. Currying may be achieved in C++ using the Standard Template Library fun
Continue ReadingC++: Flow-Control Structures
In this task, we document common flow-control structures. One common example of a flow-control structure is the goto construct. Note that Conditional
Continue ReadingC++: Black Scholes Put Option Delta
// Calculate the Black Scholes European put option Delta double BS_Put_Option_Delta(double S, double K, double r, double v, double T) // Parame
Continue ReadingC++: Lucas-Lehmer Test
Lucas-Lehmer Test: for p an odd prime, the Mersenne number 2p − 1 is prime if and only if 2p − 1 divides S(p − 1) where S(n + 1) = (S(n))2 − 2
Continue ReadingC++: For Loop with a Specified Step
Demonstrate a for-loop where the step-value is greater than one. This prints all odd digits: for (int i = 1; i < 10; i += 2) std::cout &
Continue ReadingC++: Hickerson Series of Almost Integers
The following function, due to D Hickerson, is said to generate "Almost integers" by the "Almost Integer" page of Wolfram Mathworld. (December 31 2013
Continue ReadingC++: Mode
Write a program to find the mode value of a collection. The case where the collection is empty may be ignored. Care must be taken to handle the case w
Continue ReadingC++: Pythagorean Means
Compute all three of the Pythagorean means of the set of integers 1 through 10. Show that for this set of positive integers. The most common
Continue ReadingC++: Harshad/Niven Series
The Harshad or Niven numbers are positive integers >= 1 that are divisible by the sum of their digits. For example, 42 is a Harshad number as 42
Continue Reading




