Question: what are the chances of catching a legendary pokemon with a pokeball?
Answer: Pretty all non-cover legendary pokemon have a catch rate of 3. Which means at full health, you have a 0.4% chance to catch with a Pokeball (and 0.04% chance with a beast ball!) Ultra ball has a catch modifier of 2, so if you used it whike Necrozma was at full health, you had 0.8% chance of catching it.