mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Blogorrhea > science_man_88

Reply
 
Thread Tools
Old 2022-07-20, 20:31   #1
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20D116 Posts
Default 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)))
Implementation of the first step of https://math.stackexchange.com/quest...152669#3152669
science_man_88 is offline   Reply With Quote
Old 2022-07-20, 20:46   #2
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

34×53 Posts
Default

Quote:
Originally Posted by science_man_88 View Post
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)))
Implementation of the first step of https://math.stackexchange.com/quest...152669#3152669
WB sm88.

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)))
I think znorder requires factorisation,

Last fiddled with by science_man_88 on 2022-07-20 at 21:10
paulunderwood is offline   Reply With Quote
Old 2022-07-20, 20:54   #3
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dumbassville

20D116 Posts
Default

Quote:
Originally Posted by paulunderwood View Post
WB sm88.

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)))
I think znorder requires factorisation,
Probably but x is prime in that use case no factorization overlap.

Last fiddled with by science_man_88 on 2022-07-20 at 21:11
science_man_88 is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help to install and factor large number craneduitre Msieve 23 2016-07-10 08:13
Error with large number on 32-bit machines EdH GMP-ECM 43 2013-03-01 14:27
Bug with particular large number VolMike YAFU 18 2012-04-09 21:39
Sieving a Large Number of k's Dougal Conjectures 'R Us 1 2010-06-17 21:48
Is this a relatively large number? MavsFan Math 3 2003-12-12 02:23

All times are UTC. The time now is 10:32.


Tue Oct 4 10:32:18 UTC 2022 up 47 days, 8 hrs, 0 users, load averages: 0.90, 1.22, 1.21

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔