- Fibonacci sequence
- Greatest common divisor
- Primality test
- Prime factors
- Small Calculator Interpreter
Write a function fib
that received an integer n
computes the n-th element of the Fibonacci sequence.
(Solution)
Write a function gcd
that received two integers a
and b
as input computes their Greatest common divisor.
(Solution)
Write a function isPrime
that received an integer n
checks if it is prime or not.
(Solution)
Write a function primeFactors
that received an integer n
computes the list of its prime factors.
(Solution)
Develop an interepreter of a Small Calculator. This calculator has the following keys:
- digits:
0
,1
,2
,3
,4
,5
,6
,7
,8
,9
; - operations:
+
,-
,*
,/
; - commands:
.
,=
.