Directories
¶
| Path | Synopsis |
|---|---|
|
misc
|
|
|
fibonacci
The fibonacci number of a non-negative integer n is defined as: - for n = 0, return 0 - for n = 1, return 1 - for all other positive integers, return the sum of the fibonacci values for the two preceding integers Examples: 0 => 0 (by definition) 1 => 1 (by definition) 2 => 1 3 => 2 = fib(2) + fib(1) = 1 + 1 4 => 3 = fib(3) + fib(2) = 2 + 1 5 => 5 = fib(4) + fib(3) = 3 + 2 6 => 8 = fib(5) + fib(4) = 5 + 3 7 => 13 = fib(6) + fib(5) = 8 + 5 8 => 21 = fib(7) + fib(6) = 13 + 8 9 => 34 = fib(8) + fib(7) = 21 + 13
|
The fibonacci number of a non-negative integer n is defined as: - for n = 0, return 0 - for n = 1, return 1 - for all other positive integers, return the sum of the fibonacci values for the two preceding integers Examples: 0 => 0 (by definition) 1 => 1 (by definition) 2 => 1 3 => 2 = fib(2) + fib(1) = 1 + 1 4 => 3 = fib(3) + fib(2) = 2 + 1 5 => 5 = fib(4) + fib(3) = 3 + 2 6 => 8 = fib(5) + fib(4) = 5 + 3 7 => 13 = fib(6) + fib(5) = 8 + 5 8 => 21 = fib(7) + fib(6) = 13 + 8 9 => 34 = fib(8) + fib(7) = 21 + 13 |
|
prime
Prime is a whole number n that can only be divided by 1 and itself: - for n = 0, return false - for n = 1, return false - for all other n, return true if its only two factors are 1 and n Examples: 0 => false 1 => false 2 => true 3 => true 4 => false (other factors: 2) 5 => true 6 => false (other factors: 2, 3) 7 => true 8 => false (other factors: 2, 4) 9 => false (other factors: 3) 10 => false (other factors: 2, 5) 11 => true 30 => false (other factors: 2, 3, 5, 6, 10, 15) Note: 2 is the only even number that is prime.
|
Prime is a whole number n that can only be divided by 1 and itself: - for n = 0, return false - for n = 1, return false - for all other n, return true if its only two factors are 1 and n Examples: 0 => false 1 => false 2 => true 3 => true 4 => false (other factors: 2) 5 => true 6 => false (other factors: 2, 3) 7 => true 8 => false (other factors: 2, 4) 9 => false (other factors: 3) 10 => false (other factors: 2, 5) 11 => true 30 => false (other factors: 2, 3, 5, 6, 10, 15) Note: 2 is the only even number that is prime. |
|
template
Foo is a function that for given input n ...
|
Foo is a function that for given input n ... |
Click to show internal directories.
Click to hide internal directories.