Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task 9 #29

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions iQuHack-challenge-2023-task2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
},
"outputs": [],
"source": [
"teamname=\"msft_is_the_best\" # Update this field with your team name\n",
"teamname=\"quackers\" # Update this field with your team name\n",
"task=[\"task2\"]\n",
"slack_id=\"myslackid\" # Update this field with Slack ID of the person who worked on this task as the troubleshooting contact"
]
Expand Down Expand Up @@ -174,10 +174,10 @@
"// (input will contain 5 qubits)\n",
"operation Task2(input : Qubit[], target : Qubit) : Unit is Adj {\n",
" ControlledOnInt(13, X)(input, target); // M\n",
" ControlledOnInt( 9, X)(input, target); // I\n",
" // ControlledOnInt( 9, X)(input, target); // I\n",
" ControlledOnInt(20, X)(input, target); // T\n",
"\n",
" ControlledOnInt( 9, X)(input, target); // I\n",
" // ControlledOnInt( 9, X)(input, target); // I\n",
" ControlledOnInt(17, X)(input, target); // Q\n",
" ControlledOnInt(21, X)(input, target); // U\n",
" ControlledOnInt( 8, X)(input, target); // H\n",
Expand Down
31 changes: 25 additions & 6 deletions iQuHack-challenge-2023-task3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
},
"outputs": [],
"source": [
"teamname=\"msft_is_the_best\" # Update this field with your team name\n",
"teamname=\"quackers\" # Update this field with your team name\n",
"task=[\"task3\"]\n",
"slack_id=\"myslackid\" # Update this field with Slack ID of the person who worked on this task as the troubleshooting contact"
]
Expand Down Expand Up @@ -169,12 +169,26 @@
"%%qsharp\n",
"open Microsoft.Quantum.Canon;\n",
"open Microsoft.Quantum.Diagnostics;\n",
"\n",
"open Microsoft.Quantum.Arithmetic;\n",
"// Task 3. \n",
"// (input will contain 6 qubits)\n",
"// operation Task3(input : Qubit[], target : Qubit) : Unit is Adj {\n",
"// for i in [7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56] {\n",
"// ControlledOnInt(i, X)(input, target);\n",
"// }\n",
"// }\n",
"// Task 3. \n",
"// (input will contain 6 qubits)\n",
"operation Task3(input : Qubit[], target : Qubit) : Unit is Adj {\n",
" for i in [7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38, 41, 42, 44, 49, 50, 52, 56] {\n",
" ControlledOnInt(i, X)(input, target);\n",
" // The main problem is figuring out if the input has exactly 3 bits set.\n",
" use addbits = Qubit[2]; // luckily 3 is unique from 0 to 6 mod 4\n",
" let addle = LittleEndian(addbits);\n",
" within {\n",
" for i in 0..5 {\n",
" Controlled IncrementByInteger([input[i]], (1, addle));\n",
" }\n",
" } apply {\n",
" ControlledOnInt(3, X)(addbits, target);\n",
" }\n",
"}"
]
Expand Down Expand Up @@ -415,7 +429,7 @@
"name": "python3"
},
"kernelspec": {
"display_name": "Python 3 [Default]",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -429,10 +443,15 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.10"
"version": "3.10.1 (v3.10.1:2cd268a3a9, Dec 6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)]"
},
"nteract": {
"version": "[email protected]"
},
"vscode": {
"interpreter": {
"hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
}
}
},
"nbformat": 4,
Expand Down
Loading