cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A024631 n written in fractional base 4/3.

Original entry on oeis.org

0, 1, 2, 3, 30, 31, 32, 33, 320, 321, 322, 323, 3210, 3211, 3212, 3213, 32100, 32101, 32102, 32103, 32130, 32131, 32132, 32133, 321020, 321021, 321022, 321023, 321310, 321311, 321312, 321313, 3210200, 3210201, 3210202, 3210203, 3210230, 3210231
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A244041 (sum of digits).
Cf. A024629 (base 3/2).

Programs

  • Maple
    a:= proc(n) `if`(n<1, 0, irem(n, 4, 'q')+a(3*q)*10) end:
    seq(a(n), n=0..45);  # Alois P. Heinz, Aug 20 2019
  • Mathematica
    p:= 4; q:= 3; a[n_]:= a[n]= If[n==0, 0, 10*a[q*Floor[n/p]] + Mod[n, p]]; Table[a[n], {n,0,40}] (* G. C. Greubel, Aug 20 2019 *)
  • PARI
    a(n) = my(p=4, q=3); if(n==0,0, 10*a(q*(n\p)) + (n%p));
    vector(40, n, n--; a(n)) \\ G. C. Greubel, Aug 20 2019
    
  • Sage
    def basepqExpansion(p, q, n):
        L, i = [n], 1
        while L[i-1] >= p:
            x=L[i-1]
            L[i-1]=x.mod(p)
            L.append(q*(x//p))
            i+=1
        return Integer(''.join(str(x) for x in reversed(L)))
    [basepqExpansion(4,3,n) for n in [0..40]] # G. C. Greubel, Aug 20 2019

Formula

To represent a number in base b, if a digit is greater than or equal to b, subtract b and carry 1. In fractional base a/b, subtract a and carry b.