Coding Through the Alphabet - Fibonacci in Q#
Q# is a domain-specific programming language from Microsoft used for expressing quantum algorithms. It also supports classical computation, as demonstrated here.
How to test
Prerequisites: Python 3 and the qsharp package
pip install qsharp
python3 run.py
Expected output:
0
1
1
2
3
5
8
13
21
34
Source Code
// Fibonacci sequence in Q#
// Run with: python3 run.py
operation Main() : Int[] {
mutable a = 0;
mutable b = 1;
mutable results : Int[] = [];
for _ in 0 .. 9 {
set results += [a];
let c = a + b;
set a = b;
set b = c;
}
return results;
}
Local Testing Screenshot
