20220720, 20:31  #1 
"Forget I exist"
Jul 2009
Dartmouth NS
2·3·23·61 Posts 
Large number division
Code:
div(n,x)=if(n<=10^znorder(Mod(10,x)),return(n),return(n%(10^znorder(Mod(10,x)))+div(floor(n/(10^znorder(Mod(10,x)))),x))) 
20220720, 20:46  #2  
Sep 2002
Database er0rr
2×5×19×23 Posts 
Quote:
I never know if to use my or local, but your code can be made better by: Code:
div(n,x)=local(tz=10^znorder(Mod(10,x)));if(n<=tz,return(n),return(n%tz+div(floor(n/tz),x))) Last fiddled with by science_man_88 on 20220720 at 21:10 

20220720, 20:54  #3 
"Forget I exist"
Jul 2009
Dartmouth NS
2×3×23×61 Posts 
Probably but x is prime in that use case no factorization overlap.
Last fiddled with by science_man_88 on 20220720 at 21:11 
Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Help to install and factor large number  craneduitre  Msieve  23  20160710 08:13 
Error with large number on 32bit machines  EdH  GMPECM  43  20130301 14:27 
Bug with particular large number  VolMike  YAFU  18  20120409 21:39 
Sieving a Large Number of k's  Dougal  Conjectures 'R Us  1  20100617 21:48 
Is this a relatively large number?  MavsFan  Math  3  20031212 02:23 