flat assembler
Message board for the users of flat assembler.

Index > Windows > example - small prime finder

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
tom tobias wrote:
Anyone can write "fastest code on the planet..."
If you say your code is faster then prove it. I have yet to see any other code that can do a faster FFT. Many others have written code and hoped it to be faster but still no one has managed to even match the performance.
tom tobias wrote:
Seriously, how many points are there in these FFT's?
2560k, just what I wrote.The code currently can test numbers up to ~2^593M using a larger FFTs as needed.
tom tobias wrote:
Why is it useful, i.e. why does someone or something give 100K$ for discovery of a prime number ...
If you go to the EFF website you will see that the prize is intended to promote distributed computing, the actual number is not important and AFAIK there is currently no practical uses for primes of this size.
Post 30 Sep 2008, 01:45
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
A bit sieve is very fast to generate and access:
Code:
    mov edi,sieve 
    xor ecx,ecx 
.0: bt [edi],ecx 
    inc ecx 
    jnc .0 
    ; ECX*2 + 1 is prime number (P) 
    lea eax,[ecx*2+2] 
    mul ecx ; (P+1)*(P-1)/2 
    dec eax 
    ; exit if out of range 
    cmp eax,MAX_BITS 
    jnc .x 
    ; clear bits representing odd multiples of (P) 
.1: btr [edi],eax 
    lea eax,[eax+ecx*2+1] 
    cmp eax,MAX_BITS 
    jc .1 
    jmp .0 

MAX_BITS = 1 shl 24 
; if bit(n) then (2*n+3) is prime 
sieve db MAX_BITS/8 dup (-1) 

.x:    
...once the table is created only a single instruction is needed to test an odd number for primeness. For some algorithms this can be very beneficial.

_________________
¯\(°_o)/¯ unlicense.org
Post 30 Sep 2008, 05:22
View user's profile Send private message Visit poster's website Reply with quote
SolidThink



Joined: 16 Oct 2009
Posts: 23
SolidThink
help me ! Wink

I set

PSELEND = 17894471

I would start the program automatically unless the push button start,
but do not understand where I have to make code changes.
: Cry:

simplifying ....

to do a single loop with PSELEND = 17894471
and then exits automatically when calculation has finished.

it's possible ?



;cmp [wparam],BN_CLICKED shl 16 + ID_START
;je btnnone

this code run "START" ?
Post 16 Oct 2009, 16:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.