Array of repeated conversions from decimal to base k

Marc LeBrun mlb at well.com
Thu Dec 28 20:47:06 CET 2006


 >=Jonathan Post
 > ...Recursively: T(k,1) = 10; T(k,n+1) = T(k,n) converted to base 
10 from base k, written in base 10.

This is just successive decimal rebasing.  Instead of the awkward 
phrase at the end, you could write simply using "rebase" notation:

   T(k,n+1) = k[T(k,n)]10

(and see the discussion on this list a while ago for Franklin T. 
Adams-Watters's arguably better proposed notation).

Whatever the notation, "written in base 10" in a description waves a 
red flag that we submitters should attend to, because ALL entries in 
the OEIS are, by definition, integers, and they are ALWAYS written in 
decimal!  When like language appears, more thought can yield improved 
submissions.


 > It has finite such presentation, as we hit nondecimal characters.

No, "nondecimal characters" are never an issue if the conversions are 
handled correctly with regard to data type consistency, and again 
keeping in mind the principle that the resulting OEIS entries are 
ALWAYS integers which are ALWAYS written in decimal:

   rebase(b,n,q):= if n=0 then 0 else remainder(n,b) + q * 
rebase(b,quotient(n,b),q);

Note that rebase() is a purely numerical function, involving no 
string conversions, yet it can be used to do things like reverse digits:

   reverse10(n):= rebase(10,n,1/10) * 10^floor(log10(n));

So, using rebase(), we can define

   t[k,n]:=if n=1 then 10 else rebase(k,t[k,n-1],10);

And then t[k,n]=10 for all n>9, so that, eg, the main diagonal is

   makelist(t[j,j],j,1,22); -->

     [10, 1010, 10202, 1300, 1010, 130, 61, 36, 18, 10, 10, 10, 10, 
10, 10, 10, 10, 10, 10, 10, 10, 10]


 > This is not itself "base" as it explicitly deals with conversions 
nonarbitrarily.

Actually, it's definitely "base" (as Frank said)--the clue is that 
arbitrary 10 in the rebase expression.








More information about the SeqFan mailing list