feat: move corpus to library

This commit is contained in:
alexm committed 2026-10-06 09:57:04 -04:00
1 parent df12b2a008
commit 9d351b4a0f
1301 files changed
+941859 -4

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
// An ARRAY of BOOL, nested loops with STEP, and a LIST answer.
// EXPECT: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
FUNCTION PRIMES_UP_TO(N : INTEGER) RETURNS LIST OF INTEGER
DECLARE IsPrime : ARRAY[N + 1] OF BOOL
DECLARE Found : LIST OF INTEGER
FOR I <- 0 TO N + 1
IsPrime[I] <- I >= 2
NEXT I
FOR I <- 2 TO N + 1
IF IsPrime[I] THEN
APPEND(Found, I)
FOR J <- I * I TO N + 1 STEP I
IsPrime[J] <- FALSE
NEXT J
ENDIF
NEXT I
RETURN Found
ENDFUNCTION
OUTPUT PRIMES_UP_TO(30)