  We present a quantum algorithm to obtain the response of the atomic nucleus
to a small external electromagnetic perturbation. The Hamiltonian of the system
is presented by a harmonic oscillator, and the linear combination of unitaries
(LCU) based method is utilized to simulate the Hamiltonian on the quantum
computer. The output of the Hamiltonian simulation is utilized in calculating
the dipole response with the SWAP test algorithm. The results of the response
function computed using the quantum algorithm are compared with the
experimental data and provide a good agreement. We show the results for
$^{120}$Sn and $^{208}$Pb to corroborate with the experimental data in Sn and
Pb region and also compare the results with those obtained using the
conventional linear response theory.
