flat assembler
Message board for the users of flat assembler.

 Index > Windows > example - small prime finder Goto page Previous  1, 2
Author
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 20242
revolution 30 Sep 2008, 01:45
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.
30 Sep 2008, 01:45
bitRAKE

Joined: 21 Jul 2003
Posts: 3986
Location: vpcmipstrm
bitRAKE 30 Sep 2008, 05:22
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)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
30 Sep 2008, 05:22
SolidThink

Joined: 16 Oct 2009
Posts: 23
SolidThink 16 Oct 2009, 16:07
help me !

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" ?
16 Oct 2009, 16:07
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area
Goto page Previous  1, 2

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum