Instantly share code, notes, and snippets.

# Daniel Rangel danielrangelmoreira

Created February 5, 2017 22:35

### Keybase proof

I hereby claim:

• I am danielrangelmoreira on github.
• I am danielrangel (https://keybase.io/danielrangel) on keybase.
• I have a public key ASBXWaRcYRFi-X9IvsNKjfVxst5AUGHUY_uZGoeWrdpH2Ao

To claim this, I am signing this object:

Created April 23, 2017 16:25 — forked from iandioch/totients.go
Golang implementation of Euler's totient/phi function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* * Go implementation of Euler's product formula to find for the totient function (aka. phi function) * https://en.wikipedia.org/wiki/Euler's_totient_function#Euler.27s_product_formula */ package main import ( "fmt" )
Last active April 30, 2017 20:35
Non recursive Heap (1963) algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package main import "fmt" func generate(n int, a []int64) { var c = make([]int, n) fmt.Println(a) i := 0 for i < n { if c[i] < i {
Created May 18, 2017 13:05
Insert items in a sorted slice/array (golang)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package main import "sort" import "fmt" func main() { data := []int{20, 21, 22, 24, 25, 26, 28, 29, 30, 31, 32} var items = []int{23, 27} for _, x := range items {
Last active November 17, 2020 12:41
Fastest, coolest, fibonacci algorithm golang with dynamic programming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package main import ( "fmt" "math/big" ) func fib(n int) *big.Int { fn := make([]*big.Int, n+1) for i := 0; i <= n; i++ {
Created March 19, 2017 19:37
Naive way of obtaining square roots with newton's approximation method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 package main import ( "fmt" //"math" ) func main() { const ( x0 = 54777