mersenneforum.org Large number division
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

 2022-07-20, 20:31 #1 science_man_88     "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))) Implementation of the first step of https://math.stackexchange.com/quest...152669#3152669
2022-07-20, 20:46   #2
paulunderwood

Sep 2002
Database er0rr

5·29·31 Posts

Quote:
 Originally Posted by science_man_88 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

2022-07-20, 20:54   #3
science_man_88

"Forget I exist"
Jul 2009
Dartmouth NS

2×3×23×61 Posts

Quote:
 Originally Posted by paulunderwood 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

 Similar Threads Thread Thread Starter Forum Replies Last Post craneduitre Msieve 23 2016-07-10 08:13 EdH GMP-ECM 43 2013-03-01 14:27 VolMike YAFU 18 2012-04-09 21:39 Dougal Conjectures 'R Us 1 2010-06-17 21:48 MavsFan Math 3 2003-12-12 02:23

All times are UTC. The time now is 14:04.

Sun Feb 5 14:04:11 UTC 2023 up 171 days, 11:32, 1 user, load averages: 1.50, 1.07, 0.88

Copyright ©2000 - 2023, 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.

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