43 lines
737 B
Text
43 lines
737 B
Text
;XIncludeFile "isprime.pb"
|
|
|
|
OpenConsole()
|
|
Define.d IndN, IndM, NumP, NumC, SumP, SumC
|
|
i.i = 0
|
|
IndN = 1
|
|
IndM = 1
|
|
NumP = 2
|
|
NumC = 4
|
|
SumP = 2
|
|
SumC = 4
|
|
PrintN(" sum prime sum composite sum")
|
|
While #True
|
|
If SumC > SumP:
|
|
Repeat
|
|
NumP + 1
|
|
Until isPrime(NumP)
|
|
SumP + NumP
|
|
IndN + 1
|
|
EndIf
|
|
If SumP > SumC:
|
|
Repeat
|
|
NumC + 1
|
|
Until Not isPrime(NumC)
|
|
SumC + NumC
|
|
IndM + 1
|
|
EndIf
|
|
If SumP = SumC:
|
|
PrintN(RSet(Str(SumP),14) + " - " + RSet(Str(IndN),8) + " - " + RSet(Str(IndM),8))
|
|
i + 1
|
|
If i >= 9:
|
|
Break
|
|
EndIf
|
|
Repeat
|
|
NumC + 1
|
|
Until Not isPrime(NumC)
|
|
SumC + NumC
|
|
IndM + 1
|
|
EndIf
|
|
Wend
|
|
|
|
PrintN(#CRLF$ + "Press ENTER to exit"): Input()
|
|
CloseConsole()
|