This will have the desired property, but you are only getting 5/3 bits per roll. If two rolls at a time were considered, the expected number would be 7/3 per roll.
If one has a random integer uniformly distributed from 0 to n-1, a most efficient manner of getting random bits from it is to compare the binary expansion of it with that of n. There is a first point of difference, and all subsequent bits can be used as binary random bits. If one uses that method for n=6, and reduce the number observed by 1, the posted result will be what is obtained. Less than 2 bits on the average are lost this way.
-- This address is for information only. I do not claim that these views are those of the Statistics Department or of Purdue University. Herman Rubin, Department of Statistics, Purdue University firstname.lastname@example.org Phone: (765)494-6054 FAX: (765)494-0558