Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Solving Sudoku with Grover's Search #713

Open
wants to merge 7 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
8 changes: 8 additions & 0 deletions binder-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,14 @@ These are noted in the README.md files for each sample, along with complete inst
<td>Q# standalone</td>
<td></td>
</tr>
<tr>
<td></td>
<td><strong><a href="./samples/azure-quantum/grover-sudoku/README.md">Solving Sudoku with Grover's Search</a></strong></td>
<td></td>
<td></td>
<td>Q# standalone</td>
<td></td>
</tr>
<tr>
<td><strong>Characterization:</strong></td>
<td><strong><a href="./samples/characterization/phase-estimation/README.md">Bayesian Phase Estimation</a></strong></td>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.25.218240">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ExecutionTarget>quantinuum.hqs-lt-s1-sim</ExecutionTarget>
</PropertyGroup>

</Project>
1,572 changes: 1,572 additions & 0 deletions samples/azure-quantum/grover-sudoku/GroversSudokuQuantinuum.ipynb

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions samples/azure-quantum/grover-sudoku/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
page_type: sample
author: adrianleh
description: Solving Sudoku with Grover's search, using the Azure Quantum service
ms.author: [email protected]
ms.date: 08/16/2021
languages:
- qsharp
- python
products:
- qdk
- azure-quantum
---

# Solving Sudoku with Grover's search

In this sample, we will be solving Sudoku puzzles using Grover's search.

Given that we will run our algorithm on current quantum hardware, we need to minimize qubit count and circuit depth (number of gates) required by the algorithm.

Since Grover's search is fundamentally a quantum algorithm requiring classical preprocessing, we will use the feature of Python notebooks integrating with Q#.
This will further enable us to have some convenience in the data structures we build, such as classical validation of Sudoku puzzles.

## Q# with Jupyter Notebook

Make sure that you have followed the [Q# + Jupyter Notebook quickstart](https://docs.microsoft.com/azure/quantum/install-jupyter-qdk) for the Quantum Development Kit, and then start a new Jupyter Notebook session from the folder containing this sample:

```shell
cd grover-sudoku
jupyter notebook
```

Once Jupyter starts, open the `Grovers-sudoku-quantinuum.ipynb` notebook and follow the instructions there.

## Manifest

- [GroversSudokuQuantinuum.ipynb](https://github.com/microsoft/quantum/blob/main/samples/azure-quantum/grover-sudoku/Grovers-sudoku-quantinuum.ipynb): IQ# notebook for this sample targetting Quantinuum.