## numbers of numbers with numbers of their numbers

**A** funny riddle from The Riddler where the number of numbers that indicate the numbers of their numbers is requested. By which one means numbers like 22 (two 2’s) and 21322314 (two 1’s, three 2’s, two 3’s and one 4), the convention being that “numbers consist of alternating tallies and numerals”. And that numerals are “tallied in increasing order”. A reasoning based on the number of 1’s, from zero (where 22 seems to be the only possibility) to six (where 613223141516171819 is the only case) leads to a total of 59 cases (unless zero counts as an extra case) and a brute force R exploration returns the same figure:

for (t in 1:1e5){ az=sample((0:6),9,rep=TRUE) count=rep(TRUE,9) for (i in 1:9) count[i]=(sum(az==i)+(az[i]>0))==az[i] nit=0 while ((min(count)==0)&(nit<1e2)){ j=sample((1:9)[!count],1) az[j]=(sum(az==j)+(az[j]>0)) nit=nit+1} if (min(count)==1) solz=unique.matrix(rbind(solz,az),mar=1)}

The solution published on The Riddler differs because it also includes numbers with zeros. Which I find annoying to the extreme because if zeroes are allowed then every digit not in the original solution should appear as multiplied by 0, which is self-contradictory… For instance 22 should be 012203…09, except then there is one 1, one 3, and so on.

## Leave a Reply