Remember, good things come from God.
Bad things do not come from God.
Panic attacks are bad things. Rebuke Satan, be clear that you will NOT allow evil into your life or mind.
God is more powerful than any evil, when you consciously are able to realize and recognize that, you have all the power you need to overcome your panic attacks. Refuse to focus on panic attacks when they happen, refuse to even THINK about them or allow them any power over you.
The only way you can do this is to focus on God. The way I finally overcame them is every time I felt one coming on, I would pray the “Our Father” constantly, without stopping as fast as I could get the words out. Not only was I putting my trust and faith in God, but my mind could focus on
nothing except the prayer… and if you don’t allow your mind to focus on the panic attack, it loses all power over you.
I guess counting as fast as you can would do the same thing, your mind would have to totally focus on the next number leaving it no time to focus on the panic attack. But numbers have no power over evil, God does

…therefore I always found prayer to be the FAR superior choice.
Fall asleep tonight repeating to yourself over and over that you trust God, and tonight you put your trust, your mind and your sleep in His hands, and you refuse to allow evil to control you even one more night.
DO see your doctor! And know that as you are reinforcing your faith and trust in God, there are a lot of people in the world praying the exact same prayer for you.
God Bless you and because of that may all your dreams be pleasant.