Top Cut of Convex Hull

C++. I developed an algorithm based on “three penny algorithm” to find the top cut of a convex hull for dense circle shaped data. It takes the most left point as an entry point like Jarvis’s […]

Totient Function

C++. This is the Problem 69 from Project Euler. Question: Euler’s Totient function, φ(n) [sometimes called the phi function], is used to determine the number of numbers less than n which are relatively prime to n. […]

Pell Equation

C++. This is the Problem 66 from Project Euler. Question: Consider quadratic Diophantine equations of the form:  x2 – Dy2 = 1 For example, when D=13, the minimal solution in x is 6492 – 13×1802 = 1. It can be assumed that there are […]

Pentagonal Numbers

C++. This is the Problem 44 from Project Euler. Question: Pentagonal numbers are generated by the formula, Pn=n(3n−1)/2. The first ten pentagonal numbers are: 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, … It […]

Huge Multiplication

C++, Matlab. This was one of the assignments in the algorithm course I took before. Inputs are two big integers like 60 digits each. I implemented traditional multiplication method into my algorithm. Multiplication stage takes […]

Digit Fifth Powers

C++, Matlab. This is the Problem 30 from Project Euler. Question: Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits: 1634 = 1^4 + 6^4 + 3^4 + […]

Numbers on Spiral Diagonals

C++, Matlab. This is the Problem 28 from Project Euler website. Question: Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 21 22 […]