| |
|
|
 p.specht
 |
'PrimTurbo in Assembler (C) by @Jonathan
'an Primzahlensuche, The abgeht How anything else...
Window Style 1 | 8 | 16
cls
Declare data#, ZahlenAnzahl&, StartZeit&, JN$, PrimAnz&
'prepares with the XProfan Datengenerator, (C) Frank Abbing
Declare code#
Dim code#,164
Clear code#
Long code#,0=1397791846,1448563281,35048,-1959228672,12977264,21022208
Long code#,24=37799424,54576640,71353856,88131072,104908288,121685504
Long code#,48=16827904,16859334,441,-834977536,-796187532,311087363,1946286720
Long code#,76=-1047834384,-487075445,-1957113717,-958790696,-788332285
Long code#,96=-210315461,29087723,-1962934272,63013832,-150736757,225955387
Long code#,120=-1048374902,16416770,-347868555,63474671,428425679,1499094878
Long code#,144=-1654237093,321731,-854261760,-1957165221,49920
Print "Primzahlen find To: ";
Input ZahlenAnzahl&
Dim data#, ZahlenAnzahl& + 5
Long data#, 0 = ZahlenAnzahl&
Long data#, 4 = (Sqrt(ZahlenAnzahl&) + 1) \ 1
WhileLoop 0, @SizeOf(code#) - 4
If @Long(code#, &loop) = 123456789
Long code#, &loop = data#
EndIf
EndWhile
Print "Primzahlen go sought..."
StartZeit& = &gettickcount
@Call(code#)
Dispose code#
Print ""
Print "Benötigte Time: " + @Str $((&gettickcount - StartZeit&) / 1000) + " sec."
Print "Gefundene Primzahlen: " + @Str $(@Long(data#, ZahlenAnzahl& + 1))
Print ""
' but not Ausgabeteil adaptiert on statement of/ one Primel by P. woodpecker
' SetPixel is unfortunately still damn slow!
Print "Primzahlen as s-PRIMEL present (J/n)? ";
Input JN$
If @Upper $(JN$) = "J"
declare x&,y&,c%,ri&,xx&,yy&,scale&
Window 0,0 - %maxx,%maxy-52
cls @rgb(207,207,207)
xx&=width(%hwnd)*3/5
yy&=height(%hwnd)*2/7
c%=rgb(255,0,0)
x&=0:y&=0:scale&=10' Maßstab 1 : scale&
WhileLoop 2, ZahlenAnzahl&
Ifnot @byte(data#, &loop)
setpixel xx&+x&/scale&,yy&+y&/scale&,c%
ri&=(ri&+1) mod 8
EndIf
Select ri&
caseof 0:inc x&
caseof 1:inc x&:dec y&
caseof 2:dec y&
caseof 3:dec x&:dec y&
caseof 4:dec x&
caseof 5:dec x&:inc y&
caseof 6:inc y&
caseof 7:inc x&:inc y&
endselect
inc c%
EndWhile
EndIf
Dispose data#
Print "\n ready! "
WaitInput
End
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 04/18/21 ▲ |
|
|
|