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

read more »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.

read more »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.

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.

read more »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.

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

read more »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.

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

read more »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...

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

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

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

read more »A simple yet surprisingly interesting result.

read more »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 …

read more »Insane DFS

read more »Swap and Sum

read more »Robot

read more »