Primality by trial division: Difference between revisions
m
→{{header|RPL}}
m (→{{header|RPL}}) |
m (→{{header|RPL}}) |
||
Line 4,269:
'''THEN''' DROP 0
'''ELSE'''
DUP B→R √ R→B → a maxd
≪ a #2
'''WHILE'''
'''REPEAT'''
≫
SWAP DROP '''BDIV?''' NOT
'''END'''
'''END'''
Line 4,287:
return 0
else
store a and root(a)
initialize stack with
while d does not divide a and d <= root(a)
i = 6 - i which modifies 2 into 4 and viceversa
|