len l[] 100
for a = 0 to 100 div 6
   for b = 0 to 100 div 9
      for c = 0 to 100 div 20
         n = a * 6 + b * 9 + c * 20
         if n >= 1 and n <= 100
            l[n] = 1
         .
      .
   .
.
for n = 100 downto 1
   if l[n] = 0
      print n
      break 1
   .
.
