fork download
  1. ' Name: Special Pythagorean triplet
  2. ' Created: 1401-5-13
  3. ' Language: FreeBasic
  4.  
  5. const MAXN = 2000000
  6. Dim as boolean IsNat(MAXN)
  7. Dim as LongInt i, j, prs, sum
  8. IsNat(1) = true
  9. for i = 2 to MAXN
  10. if not IsNat(i) then
  11. sum = sum + i
  12. j = 2*i
  13. while j <= MAXN
  14. IsNat(j) = true
  15. j = j+i
  16. wend
  17. endif
  18. next i
  19. PRINT sum
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty