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.

User: Renaud Gaudron

Renaud Gaudron's wiki page.

Renaud Gaudron has authored 2 sequences.

A384792 Smallest number with a n-character traditional Japanese notation.

Original entry on oeis.org

1, 11, 21, 121, 221, 1121, 1221, 11121, 11221, 111221, 211221, 1211221, 2211221, 11211221, 12211221, 111211221, 112211221, 1112211221, 2112211221, 12112211221, 22112211221, 112112211221, 122112211221, 1112112211221
Offset: 1

Author

Renaud Gaudron, Jun 10 2025

Keywords

Comments

The sequence is only well defined for a(n) < 10^52 (corresponding to n<=103), as various historical and modern sources propose different traditional Japanese notations for numbers above 10^52.
There are distinct traditional Japanese characters for digits (0-9) and for powers of ten (10, 100, 1000). For larger numbers, values are grouped by 'myriads' (10,000): For instance, 10,000 is 万 (man), 100,000,000 is 億 (oku), and 1,000,000,000,000 is 兆 (chō), and so on. Every power of 4 from 10^4 to 10^48 is represented with a single character.
Any other number is formed by combining those characters. For instance, 121 is 百二十一 ('one hundred two ten one').
Characters representing powers of 4 are always preceded by a digit. For instance, 10,001 is 一 万 一 (and not 万 一).
While there are multiple conventions for writing 1,000 (千, sen), we adhere to the convention where 千 is always preceded by a digit for the sake of consistency.
The traditional character for zero (零) is excluded since its use is limited solely to denoting the number zero.
a(n) is increasing monotonically.
a(n) can only contain digits 0, 1, or 2. Replacing any other digit with a 2 results in a smaller number with the same character count.
a(n) exhibits a modulo 8 cycle. This occurs because it takes 8 steps for each new group of four digits to reach the smallest four-digit number, 1221, which utilizes the maximum of seven characters in its traditional Japanese notation. The reason for this being an 8-step cycle, rather than a 7-step one, is due to the first step involving the 'demotion' of the previous 4-digit group's character count from seven (for 1221) to six (for 1121) as two new characters are simultaneously introduced for the subsequent number.

Examples

			Since we're excluding zero, the smallest 1-character number is 1 (一), so a(1)=1.
Numbers from 1 to 10 use only one character. The smallest number requiring two characters is 11 (十一), making a(2)=11.
Numbers from 12 to 19 also use two characters (ten + a character for 2-9), and 20 is also two characters (二十). The first number to require three characters is 21 (二十一), thus a(3)=21.
To introduce a fourth character, we must use 百 (100). While 100 itself only uses one character, combining it with the smallest 3-character number, a(3) (which is 21), creates the smallest 4-character number: 121 (百二十一). Therefore, a(4)=121.
To increase the character count further, we apply the same principle: we add a character in front of a(4). The smallest digit we can introduce is '二' (two). This yields 221 (二百二十一) as the smallest number with five characters. Therefore, a(5)=221.
The next available character to add is '千' (thousand), but in our convention, '一千' (one thousand) uses two characters. We prepend this to a(4) (the smallest 4-character number) to form 1121 (一千百二十一), which is the smallest 6-character number. Thus, a(6)=1121.
Following the same pattern, we add '一千' (one thousand) to the beginning of a(5) (the smallest 5-character number). This results in 1221 (一千二百二十一), which is the smallest number requiring seven characters. Therefore, a(7)=1221.
		

References

  • Yoshida, Mitsuyoshi. Jinkōki. 1627.

Programs

  • Python
    # Note: Valid for n <= 103, corresponding to a(n) < 10^52
    def a(n):
        return [33697,34000,33700,64000,36700,67000,33970,37000][n&7]*10**(n>>1) //30300

Formula

(By construction, valid for n<= 103, corresponding to a(n) < 10^52)
Option 1: Digit pattern
For p>=0,
a(8*p+1) is a '1', followed by '1221' p times.
a(8*p+2) is a '11', followed by '1221' p times.
a(8*p+3) is a '21', followed by '1221' p times.
a(8*p+4) is a '121', followed by '1221' p times.
a(8*p+5) is a '221', followed by '1221' p times.
a(8*p+6) is a '1121', followed by '1221' p times.
a(8*p+7) is a '1221' p+1 times.
a(8*p+8) is a '11121', followed by '1221' p times.
Option 2: Closed form
For p>=0,
a(8*p+1) = (34/303)*10^(4*p+1)-37/303
a(8*p+2) = (337/303)*10^(4*p+1)-37/303
a(8*p+3) = (64/303)*10^(4*p+2)-37/303
a(8*p+4) = (367/303)*10^(4*p+2)-37/303
a(8*p+5) = (67/303)*10^(4*p+3)-37/303
a(8*p+6) = (3397/303)*10^(4*p+2)-37/303
a(8*p+7) = (37/303)*10^(4*(p+1))-37/303
a(8*p+8) = (33697/30300)*10^(4*(p+1))-37/303

A383739 Smallest number that, when displayed on a 7-segment display using A006942, leaves exactly n segments unused.

Original entry on oeis.org

8, 0, 2, 4, 7, 1, 10, 12, 14, 17, 11, 101, 112, 114, 117, 111, 1011, 1112, 1114, 1117, 1111, 10111, 11112, 11114, 11117, 11111, 101111, 111112, 111114, 111117, 111111, 1011111, 1111112, 1111114, 1111117, 1111111, 10111111, 11111112, 11111114, 11111117, 11111111, 101111111
Offset: 0

Author

Renaud Gaudron, May 12 2025

Keywords

Comments

6, 7, and 9 each have two possible representations on a 7-segment display. Therefore, a number that contains at least one of each digit can be displayed in 8 different ways. We use 'variant 5' because it was the first one added to the OEIS (A006942).
This sequence is interesting because a(n) is guaranteed to exist for n>=1. For instance, printing a '6' will always result in 1 unused segment. If we want to get a number that returns m unused segments, then we can always return '66...66' with '6' appearing m times. This also provides an upper bound for the value of a(n). Despite this, the value of a(n) for a given n is nontrivial.
This sequence does not increase monotonically.
Certain digits can never appear in the sequence for n>=1:
- 8: This digit contributes 0 unused segments. If a solution contains an 8 and has more than one digit, the 8 can be removed entirely without reducing the number of unused segments, resulting in a smaller number. The only exception is when the number is a single digit, so for a(0).
- 3 and 5: Both use the same number of segments as 2. So, if a solution includes a 3 or 5, we can replace it with a 2 without changing the number of unused segments, but the overall number would be smaller.
- 9: Same as above: any 9 can be replaced by a 6. We can't extend this to 0 (same number of segments as 6 or 9), because we can't always swap a 6 or a 9 for a 0 (e.g. '600').
Among all 10 digits, 1 has the largest number of unused segments (5). As a consequence, when n = 5*p (with p>=1), a(n) = '1..1' with 1 appearing p times because if a(n) contained any other digit, it would be more than p digits long, and would thus not be optimal.
The next term a(5*p+1) necessarily has an additional digit. The smallest digit that adds only 1 unused segment is 0 but it cannot be placed in the leading position. The next best position is the second one, thus a(5*p+1) = '10...1' with p 1s and a single 0.
To construct the next term a(5*p+2), we swap the existing zero for another digit with an additional unused segment (2 being optimal as it is the smallest) and move it to the trailing position (to yield the smallest possible number). Hence a(5*p+2) = '1..12' with p 1s and a single 2. Any other approach, such as adding an extra 0 or swapping a 1 for something else, would result in a solution with more than p+1 digits and would thus not be optimal.
The next two terms can be constructed the same way, yielding a(5*p+3) = '1..14' and a(5*p+4) = '1..17' with again p+1 digits in total. We then loop back to the beginning with a(5*p+5).

Examples

			a(1) is the smallest number with exactly 1 unused segment. The digit 0 uses 6 segments, leaving 1 unused, and since 0 is the smallest valid number, we have a(1) = 0.
For a(6), we seek the smallest number with exactly 6 unused segments. No single-digit number meets this, as each digit leaves at most 5 segments unused. Among two-digit numbers, 10 is the smallest: '1' contributes 5 unused segments and '0' contributes 1, totaling 6. Therefore, a(6) = 10.
		

Crossrefs

Programs

  • Python
    def a(n):
        q, r = divmod(n, 5)
        if q == 0:
            return [8, 0, 2, 4, 7][r]
        if r == 0:
            return 10**q//9
        if r == 1:
            return 91*10**(q-1)//9
        return 10**(q+1)//9 + [1, 3, 6][r - 2]

Formula

For p>=1:
a(5*p) = (10^p-1)/9
a(5*p+1) = (91*10^(p-1)-1)/9
a(5*p+2) = (10^(p+1)-1)/9 + 1
a(5*p+3) = (10^(p+1)-1)/9 + 3
a(5*p+4) = (10^(p+1)-1)/9 + 6