two "find the next term" puzzles from Knuth Vol 4

N. J. A. Sloane njas at research.att.com
Mon Nov 20 23:25:04 CET 2006


the two puzzles (and their solutions) are

%I A123896
%S A123896 0,1,1,1,12,12,12,12,12,12,100,121,122,123,123
%N A123896 A123895(n^2).
...

%I A123902
%S A123902 0,1,12,100,112,121,122,123
%N A123902 A123896 sorted and uniqued.
...

which are based on this:

%I A123895
%S A123895 0,1,1,1,1,1,1,1,1,1,10,11,12,12,12,12,12,12,12,12,10,12,11,12,12,
%T A123895 12,12,12,12,12,10,12,12,11,12,12,12,12,12,12,10,12,12,12,11,12,12,
%U A123895 12,12,12,10,12,12,12,12,11,12,12,12,12,10,12,12,12,12,12,11,12,12
%N A123895 Restricted growth string for the (decimal expansion of the) number n.
%C A123895 Write n in base 10 prefixed with a 0. Read this string from left to r
ight. Write a 0 each time you see the first distinct digit (which is 0), write a
1 each time you see the second distinct digit, write a 2 each time you see the t
hird distinct digit, and so on. Finally, delete the leading zeros.
%D A123895 D. E. Knuth, TAOCP, Vol. 4, Section 7.2.1.5, Problems 4 and 5.
%e A123895 To find a(66041171): 066041171 -> 011023343 -> 11023343.
%Y A123895 Cf. A123896, A123902.
%K A123895 nonn,base,new
%O A123895 0,11
%A A123895 njas, Nov 20 2006

It would be nice if someone could extend the first two, and provide
maple or mma or other code for the third one

Neil







More information about the SeqFan mailing list