Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -1,16 +1,10 @@
|
|||
# extend SET, CLEAR and ELEM to operate on rows of BITS #
|
||||
OP SET = ( INT n, REF[]BITS b )REF[]BITS:
|
||||
BEGIN
|
||||
INT w = n OVER bits width;
|
||||
b[ w ] := ( ( 1 + ( n MOD bits width ) ) SET b[ w ] );
|
||||
b
|
||||
END # SET # ;
|
||||
# extend CLEAR and ELEM to operate on rows of BITS #
|
||||
OP CLEAR = ( INT n, REF[]BITS b )REF[]BITS:
|
||||
BEGIN
|
||||
INT w = n OVER bits width;
|
||||
b[ w ] := ( ( 1 + ( n MOD bits width ) ) CLEAR b[ w ] );
|
||||
b
|
||||
END # SET # ;
|
||||
END # CLEAR # ;
|
||||
OP ELEM = ( INT n, REF[]BITS b )BOOL: ( 1 + ( n MOD bits width ) ) ELEM b[ n OVER bits width ];
|
||||
|
||||
# constructs a bit array long enough to hold n values #
|
||||
|
|
|
|||
49
Task/Prime-conspiracy/FutureBasic/prime-conspiracy.basic
Normal file
49
Task/Prime-conspiracy/FutureBasic/prime-conspiracy.basic
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
include "NSLog.incl"
|
||||
_max = 2050000000
|
||||
byte primes(_max / 16), x, y
|
||||
uint64 trans(2, 9, 9)
|
||||
|
||||
clear local fn transitions
|
||||
uint64 n = 3, count = 1, tgt = 10000, i
|
||||
int a = 2, b, f = 3
|
||||
|
||||
while f
|
||||
if primes(n >> 4) & bit((n & 15) >> 1) then n += 2 : continue
|
||||
count ++
|
||||
b = n mod 10
|
||||
trans(0, a, b) ++
|
||||
a = b
|
||||
|
||||
i = n * n
|
||||
while i < _max
|
||||
primes( i >> 4 ) |= bit((i & 15) >> 1)
|
||||
i += (n << 1)
|
||||
wend
|
||||
|
||||
n += 2
|
||||
|
||||
if count == tgt
|
||||
f--
|
||||
fn blockmove(@trans(0, 0, 0), @trans((f), 0, 0), 800) // store current results
|
||||
tgt *= 100
|
||||
end if
|
||||
|
||||
wend
|
||||
|
||||
nslog( @"\n\t# of Primes: 10,000 1,000,000 100,000,000")
|
||||
CFStringRef s = @"%5d —> %d: %.2f%% %.2f%% %.2f%%"
|
||||
for x = 1 to 9
|
||||
for y = 1 to 9 //step 2
|
||||
if trans(0,x, y) then nslog( s, x, y, trans(2, x, y)\100, trans(1, x, y)\100^2, trans(0, x, y)\100^3)
|
||||
next
|
||||
next
|
||||
|
||||
end fn
|
||||
|
||||
nsLogSetTitle(@"Last digits of one prime to the next")
|
||||
//nsLogSetFrame(fn NSMakeRect( 0,0,400,350))
|
||||
CFTimeInterval t : t = fn CACurrentMediaTime
|
||||
fn transitions
|
||||
nslog( @"\n %.3f sec.",(fn CACurrentMediaTime - t))
|
||||
|
||||
handleevents
|
||||
Loading…
Add table
Add a link
Reference in a new issue