Find all a, b, c, d, e, such that a + b + c + d + e = 1000 with no more than 3 loops
APL (Dyalog Unicode), 23 16 bytesSBCS



Full program. No loops. Prints a list of quintuplets with two spaces between them. Each quintuplet has the variables separated by single spaces. Requires 0-indexing (⎕IO←0) which is default on many systems.

⍸1E3=⊃∘.+/5⍴⊂⍳1001


Since the above code requires more memory than available on TIO, here's exactly the same, but with a + b + c + d + e between 0 and 10 and a sum of 10:

⍸1E1=⊃∘.+/5⍴⊂⍳11.0


Try it online!

⍳1001 the ɩntegers 0…1000

⊂ enclose to treat as a unit

5⍴ reshape that to length 5

∘.+/ reduction by outer-sum (like outer product, but with plus)
this creates a 5D array with all dimensions being 1000 elements long

⊃ disclose (the reduction had to enclose the result to reduce the rank from 1  to 0)

1E3 5D Boolean mask where equal to 1000

⍸ list of ɩndices where true