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.

Showing 1-8 of 8 results.

A244040 Sum of digits of n in fractional base 3/2.

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 3, 4, 5, 3, 4, 5, 5, 6, 7, 4, 5, 6, 5, 6, 7, 7, 8, 9, 5, 6, 7, 5, 6, 7, 7, 8, 9, 8, 9, 10, 5, 6, 7, 7, 8, 9, 6, 7, 8, 7, 8, 9, 9, 10, 11, 9, 10, 11, 5, 6, 7, 7, 8, 9, 8, 9, 10, 6, 7, 8, 8, 9, 10, 8, 9, 10, 9, 10, 11, 11, 12, 13, 10, 11, 12, 5
Offset: 0

Views

Author

James Van Alstine, Jun 17 2014

Keywords

Comments

The base 3/2 expansion is unique, and thus the sum of digits function is well-defined.
Fixed point starting with 0 of the two-block substitution a,b -> a,a+1,a+2 for a = 0,1,2,... and b = 0,1,2,.... - Michel Dekking, Sep 29 2022

Examples

			In base 3/2 the number 7 is represented by 211 and so a(7) = 2 + 1 + 1 = 4.
		

Crossrefs

Programs

  • Haskell
    a244040 0 = 0
    a244040 n = a244040 (2 * n') + t where (n', t) = divMod n 3
    -- Reinhard Zumkeller, Sep 05 2014
    
  • Mathematica
    a[n_]:= a[n]= If[n==0, 0, a[2*Floor[n/3]] + Mod[n,3]]; Table[a[n], {n, 0, 85}] (* G. C. Greubel, Aug 20 2019 *)
  • PARI
    a(n) = if(n == 0, 0, a(n\3 * 2) + n % 3); \\ Amiram Eldar, Jul 30 2025
  • Python
    a244040 = lambda n: a244040((n // 3) * 2) + (n % 3) if n else 0 # David Radcliffe, Aug 21 2021
    
  • Sage
    def base32sum(n):
        L, i = [n], 1
        while L[i-1]>2:
            x=L[i-1]
            L[i-1]=x.mod(3)
            L.append(2*floor(x/3))
            i+=1
        return sum(L)
    [base32sum(n) for n in [0..85]]
    

Formula

a(0) = 0, a(3n+r) = a(2n)+r for n >= 0 and r = 0, 1, 2. - David Radcliffe, Aug 21 2021
a(n) = A007953(A024629(n)). - Amiram Eldar, Jul 30 2025

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.

A357425 Smallest number for which the sum of digits in fractional base 4/3 is n.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 10, 11, 15, 21, 22, 23, 31, 39, 43, 54, 55, 74, 75, 101, 102, 103, 138, 139, 183, 187, 246, 247, 330, 331, 439, 443, 587, 783, 790, 791, 1047, 1355, 1398, 1399, 1866, 1867, 2487, 2491, 3318, 3319, 4199, 4427, 5903, 5911, 7882, 7883, 9959
Offset: 0

Views

Author

Kevin Ryde, Sep 28 2022

Keywords

Comments

The sum of digits is A244041 and k = a(n) is the smallest A244041(k) = n.
Terms are never multiples of 4, after a(0)=0, since a multiple of 4 is a final 0 digit in base 4/3 which can be removed for the same digit sum.
Terms are strictly increasing (and so are indices of record highs in A244041) since a(n) - 1 has sum of digits n-1 and so is an upper bound for a(n-1).
If a(n) != 3 (mod 4), then the next term is a(n+1) = a(n) + 1 by incrementing the least significant digit.
If a(n) == 3 (mod 4), then an upper bound on the next term is a(n+1) <= (a(n) - r)*4/3 + r+1, where r = a(n) mod 3, by reducing the last digit to reach a multiple of 3 then append a suitable additional digit.

Examples

			For n=10, a(10) = 21 = 32131 in base 4/3 is the smallest number with sum of digits = 10.
For n=11, a(11) = 22 = 32132 in base 4/3, and which differs from a(10) simply by increasing the least significant base 4/3 digit.
		

Crossrefs

Cf. A024631 (base 4/3), A244041 (sum of digits), A363758.

Programs

  • C
    /* See links. */

A087165 a(n)=1 when n == 1 (mod 4), otherwise a(n) = a(n - ceiling(n/4)) + 1. Removing all the 1's results in the original sequence with every term incremented by 1.

Original entry on oeis.org

1, 2, 3, 4, 1, 5, 2, 6, 1, 3, 7, 2, 1, 4, 8, 3, 1, 2, 5, 9, 1, 4, 2, 3, 1, 6, 10, 2, 1, 5, 3, 4, 1, 2, 7, 11, 1, 3, 2, 6, 1, 4, 5, 2, 1, 3, 8, 12, 1, 2, 4, 3, 1, 7, 2, 5, 1, 6, 3, 2, 1, 4, 9, 13, 1, 2, 3, 5, 1, 4, 2, 8, 1, 3, 6, 2, 1, 7, 4, 3, 1, 2, 5, 10, 1, 14, 2, 3, 1, 4, 6, 2, 1, 5, 3, 9, 1, 2, 4, 7, 1, 3, 2
Offset: 1

Views

Author

Paul D. Hanna, Aug 24 2003

Keywords

Comments

Indices of records are given by A087192: a(A087192(n))=n, where A087192(n) = ceiling(A087192(n-1)*4/3).
From Benoit Cloitre, Mar 07 2009: (Start)
To construct the sequence:
Step 1: start from a sequence of 1's, leaving 3 undefined places between 1's, giving 1,(),(),(),1,(),(),(),1,(),(),(),1,(),(),(),1,(),(),(),1,...
Step 2: replace the first undefined place with a 2 and leave 3 undefined places between 2's, giving 1,2,(),(),1,(),2,(),1,(),(),2,1,(),(),(),1,2,(),(),1,...
Step 3: replace the first undefined place with a 3 and leave 3 undefined places between 3's, giving 1,2,3,(),1,(),2,(),1,3,(),2,1,(),(),3,1,2,(),(),1,...
Step 4: replace the first undefined place with a 4 and leave 3 undefined places between 4's, giving 1,2,3,4,1,(),2,(),1,3,(),2,1,4,(),3,1,2,(),(),1,...
Iterating the process indefinitely yields the sequence: 1,2,3,4,1,5,2,6,1,3,7,2,1,4,8,3,1,2,5,9,1,... (End)

Crossrefs

a(n+1) - a(n) = 4*A018902(n-3), n > 2.

Programs

  • Maple
    for n from 1 to 100 do
      if n mod 4 = 1 then A[n]:= 1
      else A[n]:= A[n - ceil(n/4)] + 1
      fi
    od:
    seq(A[n],n=1..100); # Robert Israel, Aug 05 2014
  • PARI
    a(n)=my(s); while(n>4, if(n%4==1, return(s+1)); n=(n\4*3)+max(n%4 - 1,0); s++); s+n \\ Charles R Greathouse IV, Sep 22 2022

Formula

a(n) = 4 + A244041(4*(n-1)) - A244041(4*n). - Tom Edgar and James Van Alstine, Aug 05 2014
a(4*n) = a(3*n)+1.
a(4*n+1) = 1.
a(4*n+2) = a(3*n+1)+1.
a(4*n+3) = a(3*n+2)+1. - Robert Israel, Aug 05 2014
a(n) < k*log(n) + 4 for n > 1 where k = 1/log(4/3) < 3.5. - Charles R Greathouse IV, Sep 22 2022

A363758 Maximum sum of digits for any number with n digits in fractional base 4/3.

Original entry on oeis.org

0, 3, 6, 8, 9, 12, 13, 15, 17, 19, 22, 24, 26, 28, 30, 32, 33, 36, 37, 40, 42, 44, 46, 48, 50, 52, 54, 56, 57, 60, 62, 65, 67, 70, 71, 73, 75, 77, 80, 83, 84, 87, 90, 93, 94, 96, 98, 101, 104, 106, 108, 109, 112, 115, 117, 120, 122, 123, 126, 129, 131, 133, 134
Offset: 0

Views

Author

Kevin Ryde, Jun 20 2023

Keywords

Comments

This sequence is strictly increasing since if a(n) is attained by the sum of digits of k, then the final digit of k is 3 and (k - (k mod 3))*4/3 + 3 is the same digits with a new second-least significant 1, 2 or 3 inserted, and so a(n+1) >= a(n) + 1.
Terms can be derived from A357425 by a(n) = s for the largest s where A357425(s) has n digits in base 4/3.

Examples

			For n=9, the numbers with 9 digits in base 4/3 are 60 to 79 and among them the maximum sum of digits is A244041(75) = 19 (those digits being 321023323), and so a(9) = 19.
		

Crossrefs

Cf. A024631 (base 4/3), A244041 (sum of digits).
Cf. A357425 (smallest with sum s), A087192.

Formula

a(n) = Max_{4*A087192(n-1) <= i < 4*A087192(n)} A244041(i), for n>=2.

A364779 Largest integer with sum of digits n in fractional base 4/3.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 16, 17, 32, 44, 80, 256, 257, 344, 460, 464, 620, 1472, 1964, 2620, 2624, 3500, 6224, 8300, 11068, 11072, 26240, 34988, 46652, 262144, 262145, 349528, 349529, 466040, 621392, 828524, 1104700, 1532816, 3633344, 6459280, 6459281, 11483168, 19616912
Offset: 0

Views

Author

Kevin Ryde, Aug 13 2023

Keywords

Comments

A largest integer exists since only a finite number of trailing 0 digits are possible, since each is a factor 4/3.
Each term k >= 3 has final digit d = k mod 4 which is always d < r where r = k mod 3 (and hence d = 0 or 1), since otherwise (k - r)*4/3 + r would split d into two final digits {d-r, r} for a larger number with the same sum of digits.
This sequence is strictly increasing since final digit d = 0 or 1 (and also a(2) = 2) can be incremented so that a(n)+1 is a candidate value for a(n+1).

Crossrefs

Cf. A024631 (base 4/3), A244041 (sum of digits).
Cf. A357425 (smallest of sum), A364780 (count by sum).

Programs

  • C
    /* See links */

A364780 Number of numbers with sum of digits n in fractional base 4/3.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 4, 3, 5, 6, 7, 14, 13, 15, 19, 19, 30, 39, 45, 56, 65, 75, 95, 124, 140, 174, 216, 268, 338, 417, 501, 627, 780, 974, 1203, 1454, 1825, 2266, 2769, 3427, 4268, 5188, 6433, 7930, 9671, 12000, 14738, 18265, 22642, 27961, 34528, 42523, 52325, 64425
Offset: 0

Views

Author

Kevin Ryde, Aug 13 2023

Keywords

Comments

Only a finite number of numbers have sum of digits n (the largest is A364779(n)).

Crossrefs

Cf. A024631 (base 4/3), A244041 (sum of digits).
Cf. A357425 (smallest), A364779 (largest).
Cf. A245356 (count by length).

Programs

  • C
    /* See links */

A364751 Minimum sum of digits for any number of length n digits in fractional base 4/3.

Original entry on oeis.org

0, 3, 5, 6, 6, 8, 8, 9, 10, 10, 11, 11, 11, 11, 13, 14, 16, 17, 17, 17, 18, 19, 21, 22, 22, 23, 24, 26, 26, 26, 27, 28, 29, 29, 29, 29, 29, 29, 31, 33, 34, 35, 36, 37, 38, 38, 38, 39, 39, 41, 41, 42, 42, 43, 43, 45, 45, 46, 46, 48, 50, 50, 52, 52, 52, 52, 53, 55
Offset: 1

Views

Author

Kevin Ryde, Sep 07 2023

Keywords

Comments

0 is taken to be 1 digit long so a(1) = 0.
Terms can be derived from A364779 by a(n) = s for the smallest s where k = A364779(s) is >= n digits long (noting that stripping trailing 0's from k suffices to show numbers with sum of digits s exist at each length down to where sum s-1 exists).

Crossrefs

Cf. A024631 (base 4/3), A244041 (sum of digits), A364779 (largest with sum).
Cf. A363758 (maximum sum).

Formula

a(n) = Min_{4*A087192(n-1) <= k < 4*A087192(n)} A244041(k), for n >= 2.
Showing 1-8 of 8 results.