Baby-Step Giant-Step
Here too, it is necessary to solve the equation g^x ≡ h (mod p), but now p is much larger — simple brute-force would require ~2.8·10¹² steps in the worst case, that is, several days.
The Baby-step giant-step (BSGS) algorithm reduces time at the expense of memory. The idea: we take m = ⌈√n⌉ and write it as x = i·m + j (where 0 ≤ i, j < m). Then, g^j = h · (g^(-m))^i follows from g^(i·m + j) = h.
The algorithm works in two stages: first, all baby steps g^j are written to a dictionary, then giant steps h · (g^(-m))^i are calculated and searched for in the dictionary. When a match is found, x = i·m + j. As a result, ~√n steps are enough — a few seconds.
Find x from the following equation:
p = 2772139636423
g = 5
h = 1720281519722
g^x mod p = h
Answer: only the number — in decimal format, without spaces and extra characters (for example 1234).