;Task. Convert rational a/b to its approximate [[wp:Hensel%27s_lemma#Hensel's_lemma_for_p-adic_numbers|p-adic square root]]. To check the result, square the root and construct rational m/n to compare with radicand a/b. For rational reconstruction Lagrange's [[wp:Lattice_reduction|lattice basis reduction]] algorithm is used. '''Recipe:''' find root {{math|''x1'' modulo p}} and build a sequence of solutions {{math|''f''(''xk'') ≡ 0 (mod pk)}},
using the lifting equation {{math|''xk+1'' = ''xk'' + ''dk'' * ''pk'' }} with {{math|''dk'' = –(''f''(''xk'') / ''pk'') / ''f'' ′(''x1'') (mod p)}}.
The multipliers {{math|''dk''}} are the successive p-adic digits to find. If evaluation of {{math|''f''(''x'') = ''bx2'' – ''a''}} overflows, the expansion is cut off and might be too short to retrieve the radicand. Setting a higher precision won't help, using a programming language with built-in large integer support will. ;Related task. [[p-Adic numbers, basic]] ;Reference. [https://www.uvm.edu/~cvincen1/files/teaching/spring2017-math255/quadraticequation.pdf] Solving {{math|''x2'' ≡ ''a'' (mod n)}} __TOC__