Python Forum
How do I code this equation in python (factor ceiling(2^127-1))
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I code this equation in python (factor ceiling(2^127-1))
#1
I want to factor this equation and I was doing so well on wolfram but now they want me to pay to see answers. Bummer!

How do I write the code for this one? Any help is Awesome!

Factor
ceiling(2^127-1)-1

[Image: ceiling2127-1-1.png]



http://www.wolframalpha.com/widgets/view...ddee57d91e
Reply
#2
how do you write ceiling(2^127-1)-1? i can understand (2^127-1)-1 but i don't understand ceiling() in the context of factoring. ceiling(170141183460469231731687303715884105727)-1?

are you trying to compile a list of Mersenne Primes?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#3
cypari gives some result:
>>> import cypari
>>> cypari.pari('factor({})'.format(2**127-2))
[2, 1; 3, 3; 7, 2; 19, 1; 43, 1; 73, 1; 127, 1; 337, 1; 5419, 1; 92737, 1; 649657, 1; 77158673929, 1]
Reply
#4
(Apr-22-2018, 05:15 AM)Skaperen Wrote: how do you write ceiling(2^127-1)-1? i can understand (2^127-1)-1 but i don't understand ceiling() in the context of factoring. ceiling(170141183460469231731687303715884105727)-1?

are you trying to compile a list of Mersenne Primes?

Skaperen I'm trying to predict Mersenne Primes and I know that is nuts, but I have spare time so what the heck lol.

(Apr-22-2018, 05:57 AM)Gribouillis Wrote: cypari gives some result:
 >>> import cypari >>> cypari.pari('factor({})'.format(2**127-2)) [2, 1; 3, 3; 7, 2; 19, 1; 43, 1; 73, 1; 127, 1; 337, 1; 5419, 1; 92737, 1; 649657, 1; 77158673929, 1] 
Hi,
I'm now trying to do this calculation at the interpreter and I get this error. Maybe in 10 years I'll see the answer to this one. No bad on you, but this is very complex.
My computer is running the latest version of mpmath 1.0.0

ERROR_
3**1279 % 19.1
OverflowError: int too large to convert to float
Reply
#5
(Apr-22-2018, 07:39 AM)Pleiades Wrote: OverflowError: int too large to convert to float
You need the floating type mpmath.mpf. The following computation may be correct (read the doc!)
>>> import mpmath as mp
>>> mp.mp.dps = 1000
>>> mp.mp.prec
3325
>>> x = mp.mpf(3**1279)
>>> x
mpf('17301541007910038054176056432452867095149043770336183739760994896914962855011729112692135469308113595623662446442598795834444897233706143344824357701420610156423345105638078275879693218333055393875886226458620734496461814517152992352402982745998689203987491576943864064210130929012975963553401138869026447532834194444684876122440822192338479455455335994013248316240321358466758500551665434276274478532775337486153362645579799959393898179890245190220628605618273528084601403702463029225950540686613177600948606835157545386013111476205803857649578582946755008105822347197520438156375214337925994262260644194653867.0')
>>> x % mp.mpf('19.1')
mpf('10.19999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999986211221154848220654005392902057139770156790286166144188800371401237452170538589543598035521683264914310586337686699894347939024860146540757548385574874504630831265632890197664535441563639513497048756683543708442778829491602757769872393215591581152938167421054163471394836743703044131001404204016205461841021455948652709053963994607698563023642172696945794949806477041895118333497516253529717948650209753919929653496184540071834200082524982267781226809556415809041082332587896492941756602172886446388115227194726605314781134096334203545572724145359345153758473917409997845778716764066425820393664286016039105526')
You can do it without mpmath, using only integers:
>>> (3**1279*10) % 191
102
Reply
#6
what is it you are trying to accomplish in your spare time ... factorize all non-prime Mersenne numbers? or factorize the numbers one less than Mersenne numbers? or find which are prime? are you using a gauntlet of multi-core cloud instances?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Find factor to match test curve to golden curve SriRajesh 0 464 Jun-17-2021, 04:39 AM
Last Post: SriRajesh
  Solve simple equation in Python kmll 4 1,014 Nov-01-2020, 04:34 PM
Last Post: deanhystad
  Python gives " -0.0 " as solution for an equation akar 2 724 Aug-27-2020, 12:15 PM
Last Post: akar
  Asking for help in solving a single variable nonlinear equation using Python ! NDP 0 1,110 Feb-15-2019, 12:03 PM
Last Post: NDP
  parsing text for common factor metulburr 4 3,407 Apr-28-2017, 11:04 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020