How i can solve this problem, Lucky Number

Revision en1, by Cat.Noir, 2024-02-21 02:44:39

You're given $$$a$$$, $$$b$$$. the Lucky Number is the sum of first 3 digits and last 3 digits of $$$a^{b}$$$ $$$(a \leq 2 \times 10^{9})$$$ $$$(b \leq 10^{7})$$$,

It is guaranteed that $$$a^{b}$$$ contains at least $$$6$$$ digits.

Example if $$$a = 6$$$ and $$$b = 7$$$.
$$$a^{b} = 279936$$$ Lucky Number is $$$279 + 936 = 1215$$$

input : $$$a = 24, b = 13$$$ Output : $$$1700$$$
input : $$$a = 153456, b = 3$$$ Output : $$$1177$$$

Tags number theory, modulo

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Cat.Noir 2024-02-21 02:44:39 444 Initial revision (published)