07-10-2023, 07:17 PM
Here is better prime numbers
where fraction results are stored in array:
where fraction results are stored in array:
Code: (Select All)
'prime numbers using fraction() - micro(A) by Aurel
var k,max,c,y,fr,p,n,pk,i
var fa[20]
wcolor 0,0,0 : bcolor 0,0,0:fcolor 230,230,130
print 10,5,"prime numbers micro(A) by Aurel"
print 10,25,"num prime fraction"
fcolor 130,220,220
n=0 : max = 20 : y=20 : c=0
fr = 0.0000
while n < max
y=y+20 : print 10,y,n
n=n+1
c=0:i=0
while i < n
'---------------------------------
i=i+1 :
fr = frac(n/i) : fa[i] = fr
'print 200,y,fr :swap :
if fr = 0
c=c+1
endif
'swap
wend
'----------------------------------
if c = 2
p = n
print 100,y,p
endif
swap
wend
'call fn prime()
prime()
'-------------------
func prime()
p=1 : y=40
while p < 20
y=y+20
print 200,y,fa[p]
p=p+1
wend
endfn
'--------------------
print 300,4,"Primes with fraction -> frac()..." :swap
micro(A)developer
http://basic4us.epizy.com/forum/index.php
http://basic4us.epizy.com/forum/index.php