- #1
- 81
- 55
- TL;DR Summary
- This is Shor's algorithm implemented on a Google Sheet. It demonstrates how Peter Shor's algorithm operates.
Here is a spreadsheet that demonstrates how Shor's algorithm works.
The user first enters a number 'N' that has only two prime factors. Then, the user enters a random integer 'x'. Shor's algorithm does the rest in the factorization of N. A different value for 'x' must be tried if the factoring was unsuccessful.
The second page on the spreadsheet shows values for 'N' and 'x' that have been tried. So far, N=5767 (with x=24) is the largest that works - thanks to PF user .Scott ! There are many others that should also work.
A quantum computer would use the quantum Fourier transform to calculate the period of the modular exponentiation function, but Google Sheets does not have a built-in DFT function. This is probably a good thing as it allows us to see the periodicity in the modular exponentiation function.
Here's a link to the Google Sheet. The 'N' and 'x' values can be modified here.
Shor's algorithm - Google Sheet
This is a view-only look at the Google Sheet.
The user first enters a number 'N' that has only two prime factors. Then, the user enters a random integer 'x'. Shor's algorithm does the rest in the factorization of N. A different value for 'x' must be tried if the factoring was unsuccessful.
The second page on the spreadsheet shows values for 'N' and 'x' that have been tried. So far, N=5767 (with x=24) is the largest that works - thanks to PF user .Scott ! There are many others that should also work.
A quantum computer would use the quantum Fourier transform to calculate the period of the modular exponentiation function, but Google Sheets does not have a built-in DFT function. This is probably a good thing as it allows us to see the periodicity in the modular exponentiation function.
Here's a link to the Google Sheet. The 'N' and 'x' values can be modified here.
Shor's algorithm - Google Sheet
This is a view-only look at the Google Sheet.
Last edited: