## [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.

## 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

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.

## Generate Fair Results From A Biased Coin

Given a biased coin with the probability of p to be head on each toss, where 0 < p < 1 and p ≠ 0.5, generate fair results from the biased coin.

## Generate Any One of Given Numbers According to Given Probabilities

Given N numbers, generate any one of the given numbers according to given probabilities.

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.

## [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 …

Insane DFS