1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Happy quantum new year !

Posted at

qiskit芸

構想10分実装10分


# 5-qubitの回路
n = 5
circuit = QuantumCircuit(n)
# circuit.initialize([1, 0],0) # set explicitly an inital state as |0> = [0,1] for 0th qubit
circuit.x(0)
circuit.x(2)
circuit.x(4)
circuit.measure_all()

image.png

import datetime
dt_now = datetime.datetime.now()
print('A job was queued at ' + dt_now.strftime('%Y年%m月%d日'))

job = execute(circuit, backend, shots=8192)
job_monitor(job, interval=2)
results = job.result()
counts = results.get_counts()
plot_histogram(counts)

image.png

print('Most frequent bit strig is ...?')
year = input()

Most frequent bit strig is ...?
10101

dt_now = datetime.datetime.now()
print("Happy 20{} year ! \n".format(int(year,2)))
print('Now :  ' + dt_now.strftime('%Y年%m月%d日'))

Happy 2021 year ! Now : 2021年1月1日

10101 = 21 (decimal)

結論

ibmqで年を越した

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?