Sha256: fe60d45a88770189c70e7afd5d9319f397245e2573e6de1b9431e865114faa1c
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
param $MAX := 20 Rule Main output '*.prime'.all Flow rule Sieve End Rule Sieve input '*-*.not_prime'.all or null output '*.current'.all or '*.prime'.all param $NUM := 2 Flow $NEXT_NUM := $NUM + 1 $NEXT_RULE := Sieve {NUM: $NEXT_NUM} rule Current {N: $NUM} if not :: $*.as_data_expr.match?($NUM.as_string) rule CreatePrime {N: $NUM} if ($NUM * $NUM) <= $MAX rule CreateNotPrimeAll {P: $NUM} >>> $NEXT_RULE else rule $NEXT_RULE end else if $NEXT_NUM <= $MAX rule $NEXT_RULE end end End Rule CreateNotPrimeAll output '*-{$P}.not_prime'.all param $P param $INDEX := 2 Flow if ($P * ($INDEX + 1)) <= $MAX rule CreateNotPrimeAll {P: $P, INDEX: $INDEX + 1} end rule CreateNotPrime {P: $P, N: $P * $INDEX} End Rule CreateNotPrime output '{$N}-{$P}.not_prime' param $P param $N Action touch {$N}-{$P}.not_prime End Rule CreatePrime output '{$N}.prime' param $N Action touch {$N}.prime End Rule Current output '{$N}.current' param $N Action touch {$N}.current End
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pione-0.1.3 | example/SieveOfEratosthenes/SieveOfEratosthenes.pione |