mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   enzocreti (https://www.mersenneforum.org/forumdisplay.php?f=156)
-   -   Using julia software with extremely large numbers (https://www.mersenneforum.org/showthread.php?t=23702)

enzocreti 2018-10-11 07:39

Using julia software with extremely large numbers
 
I am trying to factor 2^200 with Julia software. So I tried to write factor(2^200) but the result is 0 which is clearly wrong. How does it work BigInt in Julia for handling extremely large numbers? Have I to install some extra-package?

Batalov 2018-10-11 07:48

[QUOTE=enzocreti;497836]I am trying to factor 2^200 ...[/QUOTE]
Good luck with that!

That's an extremely large number. It has [I]like[/I] more than sixty digits in it. It's beyond capabilities of modern computers.

paulunderwood 2018-10-11 08:49

[QUOTE=enzocreti;497836]I am trying to factor 2^200 with Julia software. So I tried to write factor(2^200) but the result is 0 which is clearly wrong. How does it work BigInt in Julia for handling extremely large numbers? Have I to install some extra-package?[/QUOTE]

According to [URL="https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/#Arbitrary-Precision-Arithmetic-1"]the documentation[/URL], it looks like you have to cast it to BigInt thusly:

[CODE]factor(BigInt(2^200))[/CODE]

There might be another way to factor the number :wink:

ET_ 2018-10-11 08:55

enzo, 2^200 = 2*2*2*2*2*2*.......*2*2*2
That is, 200 times.
So 2^200 factors like 200 times 2.

henryzz 2018-10-11 12:56

[QUOTE=paulunderwood;497844]According to [URL="https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/#Arbitrary-Precision-Arithmetic-1"]the documentation[/URL], it looks like you have to cast it to BigInt thusly:

[CODE]factor(BigInt(2^200))[/CODE]

There might be another way to factor the number :wink:[/QUOTE]

Would that work or would it try to calculate the 2^200 before converting to BigInt? This wouldn't work in a lot of languages.

danaj 2018-10-11 13:49

Henry is right and I have tested. big(2^200) gives 0. big(2)^200 will give you what you want. Hence factor(big(2)^200).

With Julia v0.5 and later, factor is in the Prime package, you need to run Pkg.add("Primes") if it isn't already installed. Then

[CODE]julia> using Primes

julia> factor(big(2)^2000 * big(3)^1000 * 57 * 25)
2^2000 ⋅ 3^1001 ⋅ 5^2 ⋅ 19

julia> factor(big(2^2000))
0
[/CODE]

enzocreti 2018-10-16 09:58

JULIA
 
[QUOTE=danaj;497859]Henry is right and I have tested. big(2^200) gives 0. big(2)^200 will give you what you want. Hence factor(big(2)^200).

With Julia v0.5 and later, factor is in the Prime package, you need to run Pkg.add("Primes") if it isn't already installed. Then

[CODE]julia> using Primes

julia> factor(big(2)^2000 * big(3)^1000 * 57 * 25)
2^2000 ⋅ 3^1001 ⋅ 5^2 ⋅ 19

julia> factor(big(2^2000))
0
[/CODE][/QUOTE]

Ok thank you, I and Peter already managed to use it, but we realized that the software is too much slow for our purposes. If you want, you can always help us to find new ec-primes. Thanks!

enzocreti 2018-12-02 17:16

AMAZON EC2
 
[QUOTE=danaj;497859]Henry is right and I have tested. big(2^200) gives 0. big(2)^200 will give you what you want. Hence factor(big(2)^200).

With Julia v0.5 and later, factor is in the Prime package, you need to run Pkg.add("Primes") if it isn't already installed. Then

[CODE]julia> using Primes

julia> factor(big(2)^2000 * big(3)^1000 * 57 * 25)
2^2000 ⋅ 3^1001 ⋅ 5^2 ⋅ 19

julia> factor(big(2^2000))
0
[/CODE][/QUOTE]

Do you think that with Amazon ec2 virtual machine I can reach exponent 1 million in the search of ec-primes? Primes of the form (2^k-1)*10^d+2^(k-1)-1?

Batalov 2018-12-02 17:26

yes.
just go on and rent one.
the proof of the pudding is in the eating.


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

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