func colorful n .
   len digcnt[] 10
   arrbase digcnt[] 0
   len digits[] 8
   m = n
   while m > 0
      d = m mod 10
      if n > 9 and d <= 1
         return 0
      .
      digcnt[d] += 1
      if digcnt[d] > 1
         return 0
      .
      ndigs += 1
      digits[ndigs] = d
      m = m div 10
   .
   len products[] 36
   for i to ndigs
      p = 1
      for j = i to ndigs
         p *= digits[j]
         for k to prodcnt
            if products[k] = p
               return 0
            .
         .
         prodcnt += 1
         products[prodcnt] = p
      .
   .
   return 1
.
len cnt[] 8
len used[] 10
arrbase used[] 0
largest = 0
proc cnt_colorful taken n digits . .
   if taken = 0
      for d = 0 to 9
         used[d] = 1
         h = 1
         if d < 2
            h = 9
         .
         cnt_colorful h d 1
         used[d] = 0
      .
      return
   .
   if colorful n = 1
      cnt[digits] += 1
      largest = higher largest n
   .
   if taken < 9
      for d = 2 to 9
         if used[d] = 0
            used[d] = 1
            cnt_colorful (taken + 1) (n * 10 + d) (digits + 1)
            used[d] = 0
         .
      .
   .
.
print "Colorful numbers less than 100:"
for n = 0 to 99
   if colorful n = 1
      write n & " "
   .
.
cnt_colorful 0 0 0
print "\n\nLargest colorful number:" & largest
# 
print "\nCount of colorful numbers by number of digits:\n"
for d to 8
   print d & "   " & cnt[d]
   total += cnt[d]
.
print "\nTotal: " & total
