<jupyter_start><jupyter_text>check the qiskit version<jupyter_code>qiskit.__qiskit_version__<jupyter_output><empty_output><jupyter_text>IBM quantum experience<jupyter_code>with open('/Users/karim/staff/cred/IBMQ/tocken.txt', 'r') as file:
    myTocken = file.read().replace('\n', '')
IBMQ.save_account(myTocken,overwrite=True)
IBMQ.load_account()
IBMQ.providers()<jupyter_output><empty_output><jupyter_text>get a list of the quantum computing instances that we can run on it you can find more here: https://quantum-computing.ibm.com/lab/docs/iql/manage/account/ibmqbackends<jupyter_code>provider = IBMQ.get_provider('ibm-q')
provider.backends(simulator=False, operational=True)
provider.backends()
from qiskit.providers.ibmq import least_busy
small_devices = provider.backends(filters=lambda x: x.configuration().n_qubits <= 5 and x.configuration().n_qubits >2 and not x.configuration().simulator)
least_busy(small_devices)
big_devices = provider.backends(filters=lambda x: x.configuration().n_qubits >= 5 and not x.configuration().simulator)
big_devices
backend = least_busy(small_devices)
backend
backend.configuration().n_qubits
provider.get_backend('ibmq_quito')
num2factorize=3
factors = Shor(num2factorize)
simulator = Aer.get_backend('aer_simulator') #qasm_simulator
sim_job = QuantumInstance(backend=simulator,shots=128, skip_qobj_validation = False)
sim_algo = Shor(quantum_instance=sim_job)
sim_result = sim_algo.factor(num2factorize)
print(f"The list of factors of {num2factorize} as computed by the Shor's algorithm is {sim_result.factors[0]}.")
import math
print(f'Computed of qubits for circuit: {4 * math.ceil(math.log(num2factorize, 2)) + 2}')
print(f'Actual number of qubits of circuit: {sim_algo.construct_circuit(num2factorize).num_qubits}')<jupyter_output>Computed of qubits for circuit: 10
Actual number of qubits of circuit: 10<jupyter_text>do the same but on a quantum computer<jupyter_code>quantum_instance = QuantumInstance(backend=least_busy(small_devices),shots=128, skip_qobj_validation = False)
#quantum_instance.backend.name()
#quantum_instance.backend.provider()
quantum_instance.backend.status()
quantum_instance.backend.configuration().n_qubits
qcalc_algo = Shor(quantum_instance=quantum_instance)
qcalc_result = qcalc_algo.factor(num2factorize)
print(f"The list of factors of {num2factorize} as computed by the Shor's algorithm is {qcalc_result.factors[0]}.")<jupyter_output>The list of factors of 3 as computed by the Shor's algorithm is 3.
{'fraction_non_alphanumeric': 0.1103030303030303, 'fraction_numerical': 0.011717171717171718, 'mean_word_length': 8.450381679389313, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '508570', 'license': 'MIT', 'n_tokens_mistral': 872, 'n_tokens_neox': 826, 'n_words': 171, 'path': 'qc_workshop_20220331/demo.ipynb', 'repo_name': 'KarimElgammal/QuantumComputing', 'size': '2475'}