I hereby claim:
- I am 55v on github.
- I am 55v (https://keybase.io/55v) on keybase.
- I have a public key ASAhXYTdsR19azNYI6Sm9b2kSrmgSL_-tZosuHrI4EzhiAo
To claim this, I am signing this object:
(* | |
Problem 1 | |
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
Find the sum of all the multiples of 3 or 5 below 1000. | |
*) | |
let problem_1 n = | |
let mutable result = 0 | |
let rec loop n r = | |
if n = 0 then r | |
else |
(* | |
Problem 6 | |
The sum of the squares of the first ten natural numbers is, | |
12 + 22 + ... + 102 = 385 | |
The square of the sum of the first ten natural numbers is, | |
(1 + 2 + ... + 10)2 = 552 = 3025 | |
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 385 = 2640. | |
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum. |
(* | |
Problem 2 | |
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: | |
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... | |
Find the sum of all the even-valued terms in the sequence which do not exceed four million. | |
*) | |
let problem_2 bound = | |
let rec fsum prev preprev sum = | |
let nfib = prev + preprev | |
// Learn more about F# at http://fsharp.net | |
#light | |
let T0 = 0.0 | |
let T1 = 1.0 | |
let m = 4.0 | |
let X = [| 3.0; 1.0; 0.0; 4.0 |] | |
let Y = [| 2.0; 2.0; 1.0; 3.0 |] | |
//let XY = Array.zip(x y) | |
let h x = T0 + T1 * x |
public class Something { | |
private Something() { | |
} | |
private static class LazyHolder { | |
public static final Something INSTANCE = new Something(); | |
} | |
public static Something getInstance() { | |
return LazyHolder.INSTANCE; |
public class Something { | |
private Something() { | |
} | |
private static class LazyHolder { | |
public static final Something INSTANCE = new Something(); | |
} | |
public static Something getInstance() { | |
return LazyHolder.INSTANCE; |
I hereby claim:
To claim this, I am signing this object: