I didn't really have a good idea of how to solve this one until I started playing around with some things on the APL session. Actually, what do you call the APL REPL, anyways?

At any rate, it turned out to be a really easy solution once I realized how to get the Sundays and firsts out. I wanted to find out a way to do this without using membership, but membership seems to make it pretty easy, even if it is not the most efficient solution.

Actually, I was really surprised when I got the correct answer on the first try running this thing. :)


⍝ How many Sundays fell on the first of the month 
⍝ during the twentieth century?

⍝ Compute the Sundays of each year
⍝ We can drop the potential last Sunday because
⍝ we do not care abou it.

⍝ Compute the Firsts of each year
FIRST←1,1++31 28 31 30 31 30 31 31 30 31 30
LEAPFIRST←1,1++31 29 31 30 31 30 31 31 30 31 30