Find the number of elements in S={(x,y,z):x,y,z∈Z,x+2y+3z=42,x,y,z≥0}. We seek nonnegative integer solutions to x+2y+3z=42. For each integer z with 0≤z≤14 (since 3z≤42), we set R=42−3z and count the nonnegative solutions to x+2y=R. Because y may range from 0 to ⌊R/2⌋, and for each y the corresponding x=R−2y is nonnegative, there are ⌊R/2⌋+1 solutions for each fixed z.
Specifically, when z=0, we have R=42 and count 21+1=22; when z=1, R=39 giving 19+1=20; when z=2, R=36 giving 18+1=19; when z=3, R=33 giving 16+1=17; when z=4, R=30 giving 15+1=16; when z=5, R=27 giving 13+1=14; when z=6, R=24 giving 12+1=13; when z=7, R=21 giving 10+1=11; when z=8, R=18 giving 9+1=10; when z=9, R=15 giving 7+1=8; when z=10, R=12 giving 6+1=7; when z=11, R=9 giving 4+1=5; when z=12, R=6 giving 3+1=4; when z=13, R=3 giving 1+1=2; and when z=14, R=0 giving 0+1=1 solutions.
Summing these counts for z=0,1,…,14 yields 22+20+19+17+16+14+13+11+10+8+7+5+4+2+1=169. Therefore, the number of elements in S is 169.