Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Miller-Rabin primality test

  1. #11
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    You made a mistake, it's #5552.

    http://primes.utm.edu/primes/lists/all.txt ,

    #5552, (2^10211-1)/306772303457009724362047724636324707614338377, 3030 digits.

    I got it to work.

    Apparently, it runs OK if I don't switch to another application while it is doing the calculation.

    (I have to hurry to catch the train now.)



    Welcome to DrRacket, version 5.1 [3m].
    Language: racket.
    > (define a (/ (- (expt 2 10211) 1 ) 306772303457009724362047724636324707614338377))
    > a
    214027499482579132858887371940194720410174682692622338138373623371045292557815520045653509057682304478636294725744974976651789238833093921482920608867250818705789405057130008142306132064285305101940344523042763475816275438082461956957398106525878173567591967013410748523711930321497448154784619301982087427578086554013257185656786503572050932921341886940131084021943282522786653523825328688654928819340230360303370235518970181520387289033802457247214947248909978175882415141727984730164903804581970647000146953735297504267417832419440377208919473243565195543421718881615334948535134367639133447911232324594688215243535951946986566871991661304273052089123602813503876435919896292793639825090607457533352599118935819769435330713282137648515196027235926175883961948381508991013196439250801269563828297872094509176352753919162909010872619413584794333321812231202624131410710447566208583425922710075602111102768713021645326912585208390378351221956400677988044957906609043803535938903440761559694878054670730994693110669486310601066121391218142222553185800515119789608586891469241549939835278334745107024756491673675553607864812841413553324370643743265431950334045684031272956974012748846724367603353083165299542015407437000268554013108211049235352998867154599061172192902450631443211480297377333143398551487132200694659548889381600557163997968481288650381905936567631275227525822541606126444648951697619975596603427395471954729846036842186118055564496770804555953478592189018724100044613736718497543153016886206067742990963208754687720902252465272901815886304613986568059025443766818288836826074056630570373719268157466465160045255275463910326044933411062421320264359276822436022832349134640148605752270225362622198182098596036208743649181322997561896587617927374339975372695608841653175424143558970361575061430153730163149808158987657772324110044792872185726114110281650288934568186511187455600975197045290162116876673028341111299058673294322244163689345516056432560629003122541290834177133909469395927712284413194375985543117058027782493055150822973385039712720636424382466068254658498514918545694852209364073734159037840243544843487710434969363092770382602844208930542830780248981183044496174381844740848649903560513474126998310143686324244817292846455474996479224175994893041768202847456735670094121013565841410980001573955813472922755138802997745066765925772580380989672231239919104007287958321284025825440751798625677362350384659913180420068782328239411776395251225032411741984214433501639075120947846010020464050390907477193424987293869650698033887742390819717032303359032709898401966208279135177949329785326787567171415583335186049210079801121276570981524462732903623371608282999828629679269050841202372148497104343119800490071432719173702610963797657960238515665613543949340138714843391144085749180340221931803107038697823516338722144619716665907125031046563646482592564279123116110346022854424083008537664787417445537128879620470522557656209209655022093331866484571760614730583954562451341070311239543902959465356555362216711
    > (time-is-prime? a 0.999)
    #t
    246.243
    > (define b (+ a 2))
    > (time-is-prime? b 0.999)
    #f
    41.386
    >
    

    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  2. #12
    Member Johannes's Avatar
    Join Date
    Nov 2010
    Location
    Wuustwezel, Belgium
    Age
    56
    Posts
    95
    Rep Power
    25
    Quote Originally Posted by danbaron View Post
    You made a mistake, it's #5552.
    Not when I looked at the page.

    The time stamp for the current list, with "my" number being #5552 is
    (Tue Apr 19 14:50:52 CDT 2011)
    That looks like a time for the US continent. When I looked at the list it was 11am in Paris.
    Boole and Turing, help me!

    Primary programming: 200 MHz ARM StrongARM, RISC OS 4.02, BASIC V, ARM assembler.
    Secondary programming: 3.16 GHz Intel Core 2 Duo E8500, Vista Home Premium SP2, thinBasic, x86 assembler.

  3. #13
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    Tue Apr 19 21:30 PDT

    I thought about that on the train - that you were probably correct at the time you did it.

    They don't wait long to change the list.

    Now, the time stamp is,
    (Tue Apr 19 20:50:52 CDT 2011).

    That was approximately 2.5 hours ago.


    I therefore retract my accusation - you are exonerated, and restored to your previous position. All fines, levies and fees are rescinded. All records shall be expunged, and all properties returned to your name. I hereby declare it to be so, and so shall it be. Etc. Tip top. Cheerio.



    Last edited by danbaron; 20-04-2011 at 08:11.
    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  4. #14
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    http://primes.utm.edu/primes/lists/all.txt

    (Tue Apr 19 20:50:52 CDT 2011)

    #5393, 22971 * 2^22971 - 1, 6920 digits.

    ; new code --------------------------------------------------------------------------
    
    (define (fact n)
      (cond ((= n 1) 1)
            (else (* n (fact (- n 1))))))
    
    (define (last-digit n)
      (- n (* 10 (truncate (/ n 10)))))
    
    (define (prime-neighbor n)
      (cond
        ((= 3 (last-digit n)) (- n 2))
        (else (+ n 2))))
    
    ; REPL interactions -----------------------------------------------------------------
    
    Welcome to DrRacket, version 5.1 [3m].
    Language: racket.
    > (define a (- (* 22971 (expt 2 22971)) 1))
    > (time-is-prime? a 0.999)
    #t
    2376.215
    > (time-is-prime? (prime-neighbor a) 0.999)
    #f
    176.898
    >
    

    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  5. #15
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    http://primes.utm.edu/primes/lists/all.txt

    (Wed Apr 20 22:50:58 CDT 2011)

    #5348, 10^9999 + 33603, 10000 digits.

    ; REPL interactions ---------------------------
    
    Welcome to DrRacket, version 5.1 [3m].
    Language: racket.
    > (define a (+ (expt 10 9999) 33603))
    > (time-is-prime? a 0.999)
    #t
    3629.146
    > (time-is-prime? (prime-neighbor a) 0.999)
    #f
    610.178
    >
    

    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

  6. #16
    thinBasic MVPs danbaron's Avatar
    Join Date
    Jan 2010
    Location
    California
    Posts
    1,378
    Rep Power
    152
    http://primes.utm.edu/primes/lists/all.txt

    (Thu Apr 21 19:20:52 CDT 2011)

    #5302, (2^42737 + 1) / 3, 12865 digits.

    ; REPL interactions ---------------------------
    
    Welcome to DrRacket, version 5.1 [3m].
    Language: racket.
    > (define a (/ (+ (expt 2 42737) 1) 3))
    > (time-is-prime? a 0.999)
    #t
    7187.778
    > (time-is-prime? (prime-neighbor a) 0.999)
    #f
    1198.876
    >
    

    "You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump." - W.C.Fields

Page 2 of 2 FirstFirst 12

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •