7 Reusable Code Snippet Topics
Remove Filter
|
|
Just a couple of number tricks to check Go's mathematical abilities. If you have more, let's show them here. |
|
Another translation of one of my Python snippets. This function will return a slice of consecutive prime numbers from 2 to a given value limit. In Go the 'int' type (int32) will go as high as 2147483647, but you can replace 'int' with 'uint64' and go as high as 18446744073709551615. |
|
|
|
eg. 14 and 15 Find all the factors of 14 and 15. 1,2,7,14 are factors of 14 1,3,5,15 are factors of 15 Sum all the factors of two numbers and if sum of factors of two numbers taken are respectively equal they are Amicable numbers. |
|
Roman numbers is a standard programming exercise, to give it a small twist, we input roman numeral, turn it to value and prepare minimal version of it using the substraction rule. Correctness of the input is not checked so Garbage in - Garbage out. |
|
This is a snippet that takes a min value, max value and how many random numbers from the user then, after it checks to make sure it's not already in the list, adds the new random number to a List.. I hope it helps you..... :) |
|
[COLOR="Red"]Note two things: First off, I don't guarantee that it works well. Writing to files, if done wrong can always break things. Be careful. I mostly participate in this forum (the Python part) for fun, and my code is written like that. Second: this script is about copying things. I … |
The End.