On Mon, 2025-09-22 at 20:08 +0300, Georgi Guninski wrote:
> I need this for algorithm, so any suggestions are welcome.
>
> For integers n,D I want to compute floor(n^(1/D)) as fast as possible
> and as shown below some (n,D) are very slow.
>
> Attaching plaintext.
>
> n=4135340422190108527133182752606793910306723534619675755332171643310314802791545142347849937796753960728550149130318901202353603554858189176970179851673333220841314769020388020037753836288817542714067202084005701685018536848659752398731202783279286632073202778481147916043949125587307688586641948828478767901629384629584034178304164567671900329273192187585008485182935054618038106382493348288991273367049746743429386091419147153035068860655053634785748825627713903831589035744396002760633267750272685987379975419710843565662471192390599867618755419853042713317247350947919886544123771713595599221242126569812992070962560691614134363627231910741799597501433540116321258358786537575586553481667659367813415959773243374148031245348538233136659886568334330024533550149903451206880641591732426714609514884199626575424718596620317859447733931488021906249419989875053407835737350508812379070175649119
> time r=floor(ZZ(n)**(1/QQ(3))) #Time: CPU 7.17 s, Wall: 1.93 s
ZZ(n)**(1/QQ(3)) is giving you a symbolic result. Try
(AA(n)^(1/3)).floor() instead.