This site is supported by donations to The OEIS Foundation.

Rebasing notation

From OeisWiki
Jump to: navigation, search

b[n]q: rebase from base b into base q

In 2005, Marc LeBrun described the rebasing notation (cf. A000695):

This may be described concisely using the "rebase" notation b[n]q, which means "replace b with q in the expansion of n", thus "rebasing" n from base b into base q. The present sequence is 2[n]4. Many interesting operations (e.g., 10[n](1/10) = digit reverse, A004086, shifted by a suitable power of 10) are nicely expressible this way.
Note that q[n]b is (roughly) inverse to b[n]q.
It's also natural to generalize the idea of "basis" so as to cover the likes of F[n]2, the so-called "fibbinary" numbers (A003714) and provide standard ready-made images of entities obeying other arithmetics, say like GF2[n]2 (e.g., primes = A014580, squares = the present sequence, etc.).

The following table shows some rebasing-related sequences in the OEIS:

  b=2 b=3 b=4 b=5 b=6 b=7 b=8 b=9 b=10
q=2
A065361 A0653622 A215088 A215089 A203580     A028897
q=3 A0058361
A215090   A2150922       A028898
q=4 A000695 A023717
A303787         A028899
q=5 A033042 A0374532 A0374592
A303788       A028900
q=6 A033043 A037454 A037460 A037465
A303789     A028901
q=7 A0330441 A037455 A0374612 A037466 A037470
    A028902
q=8 A033045 A037456 A037462 A037467 A037471 A037474
  A028903
q=9 A033046   A037463 A037468 A037472 A037475 A037477
A028904
q=10 A007088 A007089 A007090 A007091 A007092 A007093 A007094 A007095
A0374792
q=11 A033047                
q=12 A033048               A1024871
q=13 A033049               A094823
q=14 A033050                
q=15 A033051                
q=16 A033052               A102489
q=17 A197351                
q=18 A197352                
q=19 A197353                
q=20 A063012               A1024911

1 These sequences have offset 1 and start with n=0.
2 These sequences have offset 1 and start with n=1.
All other sequences have offset 0 and start with n=0.

Notational variants

Sometimes variants of the notation are used in the OEIS:

  • A065361: (3)[n](2)
  • (LaTeX).

Sums of distinct powers of q

The first column (b=2) of the table above shows the sequences for Sums of distinct powers of q, since the binary digits in n enumerate all such powers.

Examples

A037454: 3[n]6
n =    0  1  2  3  4  5   6   7   8   9  10  11
a(n) = 0, 1, 2, 6, 7, 8, 12, 13, 14, 36, 37, 38, ...
n = 11: 1110 = 1023 -> 1026 = 1*6^2 + 0*6^1 + 2*6^0 = 3810 = a(11)

Programs

 rebase := proc(bfrom, n, bto)
   local c, i;
   c := convert(n, base, bfrom) ;
   add(op(i, c)*bto^(i-1), i=1..nops(c)) ;
 end proc:
 seq(rebase(3,n,6),n=0..11);
  • (Mathematica)
b:=3; q:=6; Table[FromDigits[RealDigits[n, b], q], {n, 0, 100}]
  • (PARI)
b=3; q=6; for(n=0,100,print1(fromdigits(digits(n, b), q),","));
 if n == 0
   return 0
 else
   return q * rebase(b, floor(n / b), q) + (n % b)
java -cp joeis.jar irvine.oeis.a037.A037454 3 6

Other applications

Marc LeBrun points out:

  • There are some interesting columns with q < 2 which could be added to the table above:
    • b[n]1 gives the sum of base-b digits; for example 2[n]1 is A000120, 10[n]1 is A007953
    • b[n]0 arguably* gives n mod b, the least-significant base-b digit (* depending on your 0^0 religion)
    • b[n](-1) gives the alternating base-b digit sum; for example 2[n](-1) is A065359, etc.
  • There may even be sequences with b<0 as well.
  • f(x) = b[x]q for real x with fixed b and q is an interesting function.

Also related are: