The main thread is a juggler. Don't hand him a box.
Every button runs the same 1.4 s prime search for real. Give it to the main thread and the juggler freezes mid-throw and drops every ball, just like a page that stops answering clicks. Hand it to a Web Worker and he keeps juggling. Split it across every core of your machine and the crew does several times the work in the same time.
The most common mistake: heavy work on the main thread. Every click, scroll and animation waits behind it.
Same code, moved off the main thread. The juggler never notices.
One worker per core of your machine, each checking its own slice.