-
Notifications
You must be signed in to change notification settings - Fork 1
/
problem47.sno
executable file
·28 lines (28 loc) · 1.01 KB
/
problem47.sno
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
START MATCHES = 0
LENGTH = 4
COUNTER = 2
LOOP DISTINCT = 0
INNER = 2
ACCUM = 1
COUNTING EQ(REMDR(COUNTER,INNER),0) :F(NOMATCH)
FACTOR = 2
PRIMALITY GT(FACTOR,SQRT(INNER)) :S(PRIME)
EQ(REMDR(INNER,FACTOR),0) :S(NOMATCH)
FACTOR = FACTOR + 1 : (PRIMALITY)
PRIME DISTINCT = DISTINCT + 1
SUMMING ACCUM = ACCUM * INNER
EQ(REMDR(COUNTER,ACCUM),0) :S(SUMMING)
ACCUM = ACCUM / INNER
GE(ACCUM,COUNTER) :S(FINAL)
GT(DISTINCT, LENGTH) :S(RESET)
NOMATCH INNER = INNER + 1
LT(INNER,COUNTER) :S(COUNTING)
FINAL LT(DISTINCT,LENGTH) :S(RESET)
MATCHING = MATCHING + 1
EQ(MATCHING,LENGTH) :S(FINISH)
COUNTER = COUNTER + 1 : (LOOP)
RESET MATCHING = 0
EQ(REMDR(COUNTER,1000),0) :F(SKIP)
SKIP COUNTER = COUNTER + 1 : (LOOP)
FINISH OUTPUT = COUNTER - LENGTH + 1
END