prime factorization(Solved)

New to FreeBASIC? Post your questions here.
Post Reply
Makoto WATANABE
Posts: 238
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

prime factorization(Solved)

Post by Makoto WATANABE »

Web services exists to perform prime factorization as follows.
These services can factorize a 30-digit number in just a few seconds.
https://sagecell.sagemath.org/
factor(717985416201895737890248682491)
https://keisan.casio.jp/exec/user/1380353934

With the trial division algorithm that I learned from you before, it took 10 days.
https://www.freebasic.net/forum/viewtop ... 5&start=30

Are there ways to do prime factorization faster in FreeBASIC using an appropriate library or something?
(Is there no need to use FreeBASIC since there are web services?)
If there is, please let me know, including specific code.
Last edited by Makoto WATANABE on Sep 21, 2024 7:22, edited 2 times in total.
UEZ
Posts: 1078
Joined: May 05, 2017 19:59
Location: Germany

Re: prime factorization

Post by UEZ »

I've looked to the code at https://keisan.casio.jp/exec/user/1380353934 and it seems to use the MathJax.js library which is really fast.

https://www.random-science-tools.com/ma ... actors.htm for example takes also very long time to factorize.

I don't know if BigInt is available for FB which can be used for long numbers.
srvaldez
Posts: 3592
Joined: Sep 25, 2005 21:54

Re: prime factorization

Post by srvaldez »

there is libflint but it's a very complex library also there is libpari it's complex as well but to get a working example is not too complicated although it's not FB like but rather it's like calling the pari/gp calculator from FB
if you are interested you can get the 64-bit dll plus a rough example https://u.pcloud.link/publink/show?code ... 3VrHhYL6YX
Makoto WATANABE
Posts: 238
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: prime factorization

Post by Makoto WATANABE »

Dear all.
Thanks for your quick reply.

I can now do the prime factorization of a 30 digit number "offline" in less than a second!
Long live FreeBASIC!

Image
Post Reply