#imports
from qiskit_ionq import IonQProvider
ionq_provider = IonQProvider(token='API-key-goes-here')
import numpy as np

from qiskit import QuantumCircuit, execute, Aer
from qiskit.tools.visualization import plot_histogram, array_to_latex
from qiskit.extensions import UnitaryGate

swap_gate=QuantumCircuit(2)
swap_gate.cx(0,1)
swap_gate.cx(1,0)
swap_gate.cx(0,1)
swap_gate.draw()

ata = QuantumCircuit(4)
ata.h(0)
ata.cx(0,3)
ata.measure_all()
ata.draw()


backend = ionq_provider.get_backend("ionq_simulator")#choose your backend
job = execute(ata, backend,shots=5000) #get the job object

  
result = job.result() # get result object
counts = result.get_counts() #get the counts dictionary
fig=plot_histogram(counts) #plot the histogram of the counts    
ax = fig.axes[0]
fig 

lmt = QuantumCircuit(4)
lmt.h(0)
lmt.cx(1,3)
lmt.cx(3,1)
lmt.cx(1,3)
lmt.cx(0,1)
lmt.cx(1,3)
lmt.cx(3,1)
lmt.cx(1,3)
lmt.measure_all()
lmt.draw()


backend = ionq_provider.get_backend("ionq_simulator")#choose your backend
job = execute(lmt, backend,shots=5000) #get the job object

  
result = job.result() # get result object
counts = result.get_counts() #get the counts dictionary
fig=plot_histogram(counts) #plot the histogram of the counts    
ax = fig.axes[0]
fig 

