DECLARE FUNCTION prime! (N&)
REM Разложение четного числа на сумму двух простых
CLS
INPUT "Введите четное число: ", M&
IF prime(M& - 2) = 1 THEN PRINT M&; "=2+"; M& - 2
FOR j& = 1 TO M& / 2 STEP 2
IF prime(j&) = 1 AND prime(M& - j&) = 1 THEN
PRINT M&; "="; j&; "+"; M& - j&
END IF
NEXT j&
END
FUNCTION prime (N&)
DIM j AS LONG
IF N& < 4 THEN GOTO M1
IF N& MOD 2 = 0 THEN GOTO M0
FOR j = 3 TO SQR(N&) + 1 STEP 2
IF N& MOD j = 0 THEN GOTO M0
NEXT j
M1: prime = 1: EXIT FUNCTION
M0: prime = 0
END FUNCTION