Hiroshi Kurokawa
August 27, 2018
61

# Introduction to Q#

- Quantum Computing Concepts
https://docs.microsoft.com/en-us/quantum/quantum-concepts-1-intro
- Microsoft Q# Coding Contest - Summer 2018 - Warmup
https://codeforces.com/contest/1001
- Microsoft Q# Coding Contest - Summer 2018 - Warmupの問題を解いてみた
https://qiita.com/hatoo@github/items/49b8542029a2100efabf

August 27, 2018

## Transcript

LT meetup

4. ### What’s Quantum Computing? Probabilistic vector and matrix with complex numbers

Computing using quantum- mechanical phenomena
5. ### Qubit Bit: 0 or 1 Qubit: superposition of and |0>

|1> A quibit can be represented as    α|0> + β |1>    where the prob. of |0> and |1>  is |α|2 and |β|2 respectively
6. ### Machine state Classic computerɿ 0110 Quantum computerɿ superposition of |0>

|0> |0> |0> |0> |0> |0> |1> |0> |0> |1> |0> and and … |0> |0> |1> |1> and
7. ### |0> |0> |0‌> |0͏> Machine state Classic computerɿ 0110 Quantum

computerɿ superposition of |0> |0> |0> |1͏> |0> |0> |1> |0͏> and and … |0> |0> |1> |1͏> and
8. ### |000‌0͏> Machine state Classic computerɿ 0110 Quantum computerɿ superposition of

|0001͏> |0010͏> and and … |0011͏> and
9. ### Matrix operations Hadamard operator: H  H |0> = 1/√2 (

|0> + |1> ) = |+>  H |1> = 1/√2 ( |0> - |1> ) = |-> NOT operator: X  X |0> = |1>  X |1> = |0>
10. ### Problem https:/ /codeforces.com/contest/1001/ problem/A You are given |0> and an

integer Convert the qubit to |+> if the integer is 1 |-> if the integer is -1
11. ### Solution Remember this:  H |0> = |+>  H |1> =

|->  X |0> = |1>
12. ### Solution namespace Solution { open Microsoft.Quantum.Primitive; open Microsoft.Quantum.Canon; operation Solve

(q : Qubit, sign : Int) : () { body { // q is set as |0> if (sign == 1) { H(q); } else { X(q); // ﬂip q to make it |1> H(q); } } } }
13. ### Matrix operations CNOT operator  CNOT( |0> |0> ) = |0>

|0>  CNOT( |0> |1> ) = |0> |1>  CNOT( |1> |0> ) = |1> |1>  CNOT( |1> |1> ) = |1> |0>
14. ### Problem https:/ /codeforces.com/contest/1001/ problem/B You are given |00> Convert |00>

→ 1/√2( |00> + |11>)
15. ### Solution Hint:  |+> |0> = 1/√2 (|0> + |1>) |0>

= 1/√2 (|00> + |10> Remember CNOT:  CNOT( |0> |0> ) = |0> |0>  CNOT( |0> |1> ) = |0> |1>  CNOT( |1> |0> ) = |1> |1>  CNOT( |1> |1> ) = |1> |0> |11>
16. ### Solution namespace Solution { open Microsoft.Quantum.Primitive; open Microsoft.Quantum.Canon; operation Solve

(qs : Qubit[], index : Int) : () { body { let x = qs[0]; let y = qs[1]; H(x); CNOT(x, y); } } }
17. ### Reference Quantum Computing Concepts  https:/ /docs.microsoft.com/en-us/quantum/quantum- concepts-1-intro Microsoft Q# Coding

Contest - Summer 2018 - Warmup  https:/ /codeforces.com/contest/1001 Microsoft Q# Coding Contest - Summer 2018 - Warmupͷ໰୊Λղ͍ͯΈͨ  https:/ /qiita.com/hatoo@github/items/ 49b8542029a2100efabf