[Golang] Distinct powers - Problem 29 - Project Euler

Go solution to Distinct powers - Problem 29 - Project Euler.

[Golang] Number spiral diagonals - Problem 28 - Project Euler

Go solution to Number spiral diagonals - Problem 28 - Project Euler.

[Golang] Names scores - Problem 22 - Project Euler

Go solution to Names scores - Problem 22 - Project Euler.

[Golang] Counting Sundays - Problem 19 - Project Euler

Go solution to Counting Sundays - Problem 19 - Project Euler.

[Golang] Pandigital products - Problem 32 - Project Euler

Go solution to Pandigital products - Problem 32 - Project Euler.

[Golang] Coin sums - Problem 31 - Project Euler

Go solution to Coin sums - Problem 31 - Project Euler.

[Golang] Naive Method for Primality Test

Naive method for primality test in Go: Given a natural number n, if n is divisible by any number from 2 to square root of n, then n is composite. Otherwise n is prime.

Online Calcualte Politeness of Number

Calculate politeness of a number online, i.e., the number of ways it can be expressed as the sum of consecutive integers.

Calcualte Politeness of Number in Golang

Calculate politeness of a number in Go, i.e., the number of ways it can be expressed as the sum of consecutive integers

Online Calculate Sum of Proper Divisors

Online tool for prime factorization and calculating sum of proper divisors. The algorithm is implemented in JavaScript and UI in Vue.js.

[Golang] Digit fifth powers - Problem 30 - Project Euler

Go solution to Digit fifth powers - Problem 30 - Project Euler.

Online Prime Factorization

Online tool that helps you do prime factorization. The algorithm is implemented in JavaScript and UI in Vue.js.

[Vue.js] Online Sieve of Eratosthenes Demo

Sieve of Eratosthenes is a simple and ancient method to find prime numbers up to a given limit. Given a limit, this online demo returns all prime number below the limit.

Online Sieve of Eratosthenes Demo via Go and Vue.js

Online demo of sieve of eratosthenes via Go/GopherJS/gopherjs-vue.

[Vue.js] Online Euler's Totient Function Demo

Euler's Totient Function φ(n) counts the positive integers that are relatively prime to n. This online demo use naive method to calculate φ(n) and positive integers coprime to n.

[Vue.js] Online Goldbach's Conjecture Demo

Goldbach's conjecture - Every even integer greater than 2 can be written as the sum of two primes. Given a positive even integer, this online demo returns the two primes.

[JavaScript] Sieve of Eratosthenes

JavaScript implementation of Sieve of Eratosthenes.

[Golang] Solution to Project Euler

Go solution to Project Euler.

[Golang] Quadratic primes - Problem 27 - Project Euler

Go solution to Quadratic primes - Problem 27 - Project Euler.

Check If A Large Number Is Divisible By 3 Or Not

Check if a large number is divisible by 3 or not in Go. This exercise is good example for type casting between int and string in Go.

Online Lemoine’s Conjecture Demo in Go

2n + 1 = p + 2q always has a solution in primes p and q (not necessarily distinct) for n > 2. This online demo finds p and q for given odd number greater than 5. The demo is written in Go and compiled to JavaScript using GopherJS.

Online Lemoine’s Conjecture Demo

2n + 1 = p + 2q always has a solution in primes p and q (not necessarily distinct) for n > 2. This online demo finds p and q for given odd number greater than 5.

Lemoine’s Conjecture

2n + 1 = p + 2q always has a solution in primes p and q (not necessarily distinct) for n > 2. Write a Go program to find p and q for given odd number greater than 5.

Lychrel Number Test

Test if a number (at least 2-digit) is Lychrel number or not under limited iterations in Go.

[Golang] Non-abundant sums - Problem 23 - Project Euler

Go solution to Non-abundant sums - Problem 23 - Project Euler.

Descartes' rules of signs

Hard to believe that I don't remember seeing Descartes' rules of signs before -- you'd think this is impossible given the time I spent on ...

[Golang] Number letter counts - Problem 17 - Project Euler

Go solution to Number letter counts - Problem 17 - Project Euler.

[Golang] Convert Numbers to Words From 1 to 1000

Spell numbers from 1 to 1000 in English via Go programming language.

Helly's theorem

This is the last of a small series of similar and basic results in convex geometry.

[Golang] 1000-digit Fibonacci number - Problem 25 - Project Euler

Go solution to 1000-digit Fibonacci number - Problem 25 - Project Euler.

[Golang] Factorial digit sum - Problem 20 - Project Euler

Go solution to Factorial digit sum - Problem 20 - Project Euler.

[Golang] Large Positive Integer Multiplication

Multiplication of big natural numbers in Go. This is for very large positive integers which overflows the built-in numerical type in Go.

[Golang] Power digit sum - Problem 16 - Project Euler

Go solution to Power digit sum - Problem 16 - Project Euler.

[Golang] Lattice paths - Problem 15 - Project Euler

Go solution to Lattice paths - Problem 15 - Project Euler.

[Golang] Large sum - Problem 13 - Project Euler

Go solution to Large sum - Problem 13 - Project Euler.

Addition of big natural numbers in Go. This is for very large positive integers which overflows the built-in numerical type in Go.

Caratheodory's theorem

Previous I used Caratheodory's theorem to prove Radon's theorem, now I'm going to prove the former.

[Golang] Largest product in a grid - Problem 11 - Project Euler

Go solution to Largest product in a grid - Problem 11 - Project Euler.

I came across Radon's theorem the other day, and found this proof. It must have been discovered before.

[Golang] Even Fibonacci Numbers - Problem 2 - Project Euler

Go solution to Even Fibonacci numbers - Problem 2 - Project Euler.

[Golang] Multiples of 3 and 5 - Problem 1 - Project Euler

Go solution to Multiples of 3 and 5 - Problem 1 - Project Euler.

This is not hard but still interesting. A spread of an array of numbers is the difference between its maximum and minimum. Given an array...

Finding the maximum rectangle under a histogram

I heard this is classic, but turns out not too hard.

Find pivot from a stream

This is also an interesting result, although it's quite simple.

Finding singletons

For (iin{1,2,3}), there are (2n+i) integers consisting of (n+i) unique ones.

Online number partitioning

A simple yet surprisingly interesting result.

Balancing numbers

There are 2n+1 coins each associated with a weight. When we remove any coin, we can split the rest into two piles each with n coins...

Numbers game

Given a sequence of (n) integers (a_1,ldots,a_n), we map it to ...

No crossing!

On the 2D plane there are (n) blue and (n) red points, no three of them are co-linear. Then we can always pair a blue point with a red ...

[Golang] Calculate Number of Divisors

Given a natural number (integer), calculate the number of divisors of it in Go programming language.

[Golang] Highly Divisible Triangular Number - Problem 12 - Project Euler

Go solution to highly divisible triangular number - Problem 12 - Project Euler.

[Golang] Largest Product in a Series - Problem 8 - Project Euler

Go solution to largest product in a series - Problem 8 - Project Euler.

[Golang] Sum Square Difference - Problem 6 - Project Euler

Go solution to sum square difference - Problem 6 - Project Euler.

[Golang] Longest Collatz Sequence - Problem 14 - Project Euler

Go solution to longest Collatz sequence - Problem 14 - Project Euler.

[Golang] Summation of Primes - Problem 10 - Project Euler

Go solution to summation of primes - Problem 10 - Project Euler.

[Golang] 10001st Prime - Problem 7 - Project Euler

Go solution to 10001st prime - Problem 7 - Project Euler.

[Golang] Goldbach's conjecture

Goldbach's conjecture - Every even integer greater than 2 can be written as the sum of two primes. Given a positive even integer, write a Go program to find the two primes.

[Golang] Euler's Totient Function

Euler's totient function implementation in Go programming language.

[Golang] Calculate Least Common Multiple (LCM) by GCD

Find least common multiple (LCM) by greatest common divisor (GCD) via Go programming language.

[Golang] Smallest Multiple - Problem 5 - Project Euler

Go solution to smallest multiple - Problem 9 - Project Euler.

[Golang] Special Pythagorean Triplet - Problem 9 - Project Euler

Go solution to special Pythagorean triplet - Problem 9 - Project Euler.

[Golang] Amicable Numbers - Problem 21 - Project Euler

Go solution to amicable numbers - Problem 21 - Project Euler.

Maximum number of pairwise non-acute vectors in R^n

It is said to be well-known, but perhaps I've never seen it before:

2017 APMO Problem 3

Let (A(n)) denote the number of sequences (a_1ge a_2gecdots{}ge a_k) of positive integers for which (a_1+cdots+a_k = n) and each ...

APMO 2017 Problem 1

We call a (5)-tuple of integers arrangeable if its elements can be labeled (a, b, c, d, e) in some order so that (a-b+c-d+e=29). Deter...

[Golang] Integer Exponentiation

Integer exponentiation in Go programming language.

[Golang] Sum of the Proper Divisors (Factors)

Calculate the sum of all proper divisors (factors) of an integer number in Go programming language.

[Golang] Largest Prime Factor - Problem 3 - Project Euler

Go solution to largest prime factor of 600851475143 - Problem 3 - Project Euler.

[Golang] Greatest Common Divisor via Euclidean Algorithm

Compute the greatest common divisor (GCD) via Euclidean algorithm in Go programming language.

[Golang] Get All Prime Factors of Integer Number

Prime Factorization - Find all prime factors of a given integer number in Go programming language.

2009 USAMO Problem 3

I found a different solution to the second part of this problem. We define a chessboard polygon to be a polygon whose edges are situate...

[Golang] Largest Palindrome Product - Problem 4 - Project Euler

Go solution to largest palindrome made from the product of two 3-digit numbers. - Problem 4 - Project Euler.

USAMO 2017 Problem 2

Let (m_1, m_2, ldots, m_n) be a collection of (n) positive integers, not necessarily distinct. For any sequence of integers (A = (a_1...

USAMO 2008 Problem 3

The problem is rephrased. Q: A diamond of size n consists of 2n rows of nodes with lengths from top to bottom being 1, 3, 5, ..., 2n-1...

USAMO 2017 Problem 4

Let (P_1, P_2, dots, P_{2n}) be (2n) distinct points on the unit circle (x^2+y^2=1), other than ((1,0)). Each point is colored eit...

[Golang] Primality Test - Optimized School Method

Go implementation of primality test - optimized school method.

[Golang] Sieve of Eratosthenes

Go implementation of Sieve of Eratosthenes.

IMO 2007 Problem 3

In a mathematical competition some competitors are friends. Friendship is always mutual. Call a group of competitors a clique if each two of...

IMO 2016 Problem 6

There are n>=2 line segments in the plane such that every two segments cross and no three segments meet at a point. Geoff has to choose an ...

[Algorithm] Magical Recurrence

In a recent algorithmic coding contest which I didn't do well, the hardest problem killed me. It distinguished me from other superior coders. But it's still an interesting one. The problem is essentially to solve a 0/1 knapsack problem on a tree where each node is associated with an …