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-10 of 17 results. Next

A323286 Choix de Bruxelles (version 1): irregular table read by rows in which row n lists all the legal numbers that can be reached by halving or doubling some substring of the decimal expansion of n.

Original entry on oeis.org

2, 1, 4, 6, 2, 8, 10, 3, 12, 14, 4, 16, 18, 5, 20, 12, 21, 22, 6, 11, 14, 22, 24, 16, 23, 26, 7, 12, 18, 24, 28, 25, 30, 110, 8, 13, 26, 32, 112, 27, 34, 114, 9, 14, 28, 36, 116, 29, 38, 118, 10, 40, 11, 22, 41, 42, 11, 12, 21, 24, 42, 44, 13, 26, 43, 46, 12
Offset: 1

Views

Author

N. J. A. Sloane, Jan 14 2019

Keywords

Comments

Take the decimal expansion of n, say n = d_1 d_2 ... d_k. We can choose to map it to any number that can be obtained by the following process. Take any substring d_i, d_{i+1}..., d_j that does not begin with 0. If the number represented by this substring is odd, replace it with twice the number. If it is even either halve it or double it.
The substring may increase or decrease in length. We do not pad it with zeros if it decreases in length.
For example, if n = 20129, then by acting on single-digit substrings we get 10129, 40129, 20229, 20119, 20149, 201218. Acting on 2-digit substrings we get in addition 2069 (halve the 12!), 20249, 20158. From 3-digit substrings we also get 40229, 20258; from 4-digit substrings we get 40249; and from 5-digit substrings we get 40258.
Eric Angelini asks what is the smallest number of steps needed to reach n if we start at 1 and repeatedly apply this process? We can reach 2 in 1 step, 4 in 2 steps, 13 in five steps, and so on.
Lars Blomberg has shown, by considering just the final digit of the numbers in the trajectory, that no number ending in 0 or 5 can be reached from 1. All other numbers can be reached (cf. A323454) - see proof below.
Update, Jan 15 2019: Lorenzo Angelini has found that 3 can be reached from 1 in 11 steps: 1, 2, 4, 8, 16, 112, 56, 28, 14, 12, 6, 3. No shorter path is possible.
From N. J. A. Sloane, Jan 16 2019: (Start)
Theorem: If k > 1 does not end in 0 or 5 then it can be reached from 1.
Proof: Suppose not, and let k be the smallest such number. Note that the allowed operations are invertible: if a -> b then also b -> a. So that means that
*** all the descendants of k must be bigger than k ***
(if there was a descendant < k, then it would also be unreachable from 1, which is a contradiction to k being the smallest).
All digits of k must be odd (if there were an even digit > 0, halve it and get a smaller number; if there is a zero digit, say we see a0, then we halve a0 and get a smaller number).
If all the digits of k are 1, do 111...1 -> 111...2 -> 55..56, a smaller number.
If there is a digit 3, 7, or 9, we know we can get that single digit down to 1 (see A323454), again a contradiction.
But all the digits can't be 5. QED (End)

Examples

			The triangle begins:
   2;
   1,   4;
   6;
   2,   8;
  10;
   3,  12;
  14;
   4,  16;
  18;
   5,  20;
  12,  21,  22;
   6,  11,  14,  22,  24;
  16,  23,  26;
   7,  12,  18,  24,  28;
  25,  30, 110;
   8,  13,  26,  32, 112;
  27,  34, 114;
   9,  14,  28,  36, 116;
  29,  38, 118;
  10,  40;
  11,  22,  41,  42;
  11,  12,  21,  24,  42,  44;
  ...
		

References

  • Eric Angelini, Email to N. J. A. Sloane, Jan 14 2019.

Crossrefs

The number of terms in row n is given by A323287.
See A323460 for the (preferred) version 2 where n can also be mapped to itself.
See also A323288 (row maxima), A323289, A323452, A323453, A323454, A323455 (a binary analog).
For variants of the Choix de Bruxelles operation, see A337321 and A337357.

Programs

  • PARI
    See Sigrist link.
    
  • Python
    def cdb(n):
        s, out = str(n), set()
        for l in range(1, len(s)+1):
            for i in range(len(s)+1-l):
                if s[i] == '0': continue
                t = int(s[i:i+l])
                out.add(int(s[:i] + str(2*t) + s[i+l:]))
                if t&1 == 0: out.add(int(s[:i] + str(t//2) + s[i+l:]))
        return sorted(out)
    print([c for n in range(1, 25) for c in cdb(n)]) # Michael S. Branicky, Jul 24 2022

Extensions

Data corrected by Rémy Sigrist, Jan 15 2019

A323460 Choix de Bruxelles, version 2: irregular table read by rows in which row n lists all the legal numbers that can be reached by halving or doubling some substring of the decimal expansion of n (including the empty string).

Original entry on oeis.org

1, 2, 1, 2, 4, 3, 6, 2, 4, 8, 5, 10, 3, 6, 12, 7, 14, 4, 8, 16, 9, 18, 5, 10, 20, 11, 12, 21, 22, 6, 11, 12, 14, 22, 24, 13, 16, 23, 26, 7, 12, 14, 18, 24, 28, 15, 25, 30, 110, 8, 13, 16, 26, 32, 112, 17, 27, 34, 114, 9, 14, 18, 28, 36, 116, 19, 29, 38
Offset: 1

Views

Author

N. J. A. Sloane, Jan 22 2019

Keywords

Comments

The differs from the first version (in A323286) in that now n can be reached from n (by using the empty string).
This slight modification of the definition makes the analysis simpler.
The number of numbers that can be reached from n in one step is A323287(n)+1.
The minimal number of steps to reach n starting at 1 is still given by A323454.

Examples

			Rows 1 through 20 are:
1, 2,
1, 2, 4,
3, 6,
2, 4, 8,
5, 10,
3, 6, 12,
7, 14,
4, 8, 16,
9, 18,
5, 10, 20,
11, 12, 21, 22,
6, 11, 12, 14, 22, 24,
13, 16, 23, 26,
7, 12, 14, 18, 24, 28,
15, 25, 30, 110,
8, 13, 16, 26, 32, 112,
17, 27, 34, 114,
9, 14, 18, 28, 36, 116,
19, 29, 38, 118,
10, 20, 40
		

Crossrefs

Programs

  • Python
    def cdb2(n):
        s, out = str(n), {n}
        for l in range(1, len(s)+1):
            for i in range(len(s)+1-l):
                if s[i] == '0': continue
                t = int(s[i:i+l])
                out.add(int(s[:i] + str(2*t) + s[i+l:]))
                if t&1 == 0: out.add(int(s[:i] + str(t//2) + s[i+l:]))
        return sorted(out)
    print([c for n in range(1, 21) for c in cdb2(n)]) # Michael S. Branicky, Jul 24 2022

A323454 Minimal number of steps to reach n from 1 using "Choix de Bruxelles", version 2 (cf. A323460), or -1 if n cannot be reached.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jan 15 2019

Keywords

Comments

This is equally the minimal number of steps to reach n from 1 using "Choix de Bruxelles", version 1 (cf. A323286), or -1 if n cannot be reached.
n cannot be reached if its final digit is 0 or 5, but all other numbers can be reached (see comments in A323286).

Examples

			Examples of optimal ways to reach 1,2,3,...:
1
1, 2
1, 2, 4, 8, 16, 112, 56, 28, 14, 12, 6, 3
1, 2, 4
5 cannot be reached, ends in 0 or 5
1, 2, 4, 8, 16, 112, 56, 28, 14, 12, 6
1, 2, 4, 8, 16, 112, 56, 28, 14, 7
1, 2, 4, 8,
1, 2, 4, 8, 16, 112, 56, 28, 18, 9.
10 cannot be reached, ends in 0 or 5
1, 2, 4, 8, 16, 112, 56, 28, 24, 22, 11
1, 2, 4, 8, 16, 112, 56, 28, 14, 12
1, 2, 4, 8, 16, 13
1, 2, 4, 8, 16, 112, 56, 28, 14
15 cannot be reached, ends in 0 or 5
1, 2, 4, 8, 16
1, 2, 4, 8, 16, 32, 34, 17
1, 2, 4, 8, 16, 112, 56, 28, 18
1, 2, 4, 8, 16, 32, 34, 38, 19
20 cannot be reached, ends in 0 or 5
...
		

Crossrefs

For variants of the Choix de Bruxelles operation, see A337321 and A337357.

Extensions

More terms from Rémy Sigrist, Jan 15 2019

A323289 Total number of distinct numbers that can be obtained by starting with 1 and applying the "Choix de Bruxelles", version 2 (A323460) operation at most n times.

Original entry on oeis.org

1, 2, 3, 4, 5, 9, 24, 59, 136, 362, 1365, 5992, 28187, 135951, 689058, 3908456, 24849118, 171022869, 1248075797
Offset: 0

Views

Author

N. J. A. Sloane, Jan 15 2019

Keywords

Comments

Equally, this is the total number of distinct numbers that can be obtained by starting with 1 and applying the "Choix de Bruxelles", version 1 (A323286) operation at most n times.

Examples

			After applying Choix de Bruxelles (version 1) twice to 1, we have seen the numbers {1,2,4}, so a(2)=3. After 5 applications, we have seen {1,2,4,8,16,13,26,32,112}, so a(5) = 9.
		

Crossrefs

Cf. A323286, A323287, A323452 (first differences), A323453, A323460.

Programs

  • Python
    from itertools import islice
    def cdb2(n):
        s, out = str(n), {n}
        for l in range(1, len(s)+1):
            for i in range(len(s)+1-l):
                if s[i] == '0': continue
                t = int(s[i:i+l])
                out.add(int(s[:i] + str(2*t) + s[i+l:]))
                if t&1 == 0: out.add(int(s[:i] + str(t//2) + s[i+l:]))
        return out
    def agen():
        reach, expand = {1}, [1]
        while True:
            yield len(reach)
            newreach = {r for q in expand for r in cdb2(q) if r not in reach}
            reach |= newreach
            expand = list(newreach)
    print(list(islice(agen(), 15))) # Michael S. Branicky, Jul 24 2022

Extensions

a(7)-a(16) from Rémy Sigrist, Jan 15 2019
Deleted an incorrect comment. - N. J. A. Sloane, Jan 24 2019
a(17) from Michael S. Branicky, Jul 24 2022
a(18) from Michael S. Branicky, Jul 26 2022

A323453 Largest number that can be obtained by starting with 1 and applying "Choix de Bruxelles (version 2)" (see A323460) n times.

Original entry on oeis.org

1, 2, 4, 8, 16, 112, 224, 512, 4416, 44112, 88224, 816448, 8164416, 81644112, 811288224, 8112816448, 81128164416, 811281644112, 8112811288224, 81128112816448, 811281128164416, 8112811281644112, 81128112811288224, 811281128112816448, 8118112281128164416, 81181122811281644112
Offset: 0

Views

Author

N. J. A. Sloane, Jan 15 2019

Keywords

Comments

Also, largest number that can be obtained by starting with 1 and applying the original "Choix de Bruxelles" version 1 operation (as defined in A323286) at most n times.
a(n) is the largest number that can be obtained by applying Choix de Bruxelles (version 2) to all the numbers that can be reached from 1 by applying it n-1 times.
a(n+1) >= A323460(a(n)) (but equality does not always hold). See A307635. - Rémy Sigrist, Jan 15 2019

Examples

			After applying Choix de Bruxelles (version 2) 4 times to 1, we have the numbers {1,2,4,8,16}. Applying it a fifth time we get the additional numbers {13,26,32,112}, so a(5) = 112.
		

Crossrefs

Formula

a(n+4) = decimal concatenation of 8112 and a(n) for n >= 10.

Extensions

a(9)-a(16) from Rémy Sigrist, Jan 15 2019. Further terms from N. J. A. Sloane, May 01 2019

A323287 Number of different numbers that can be obtained from (the decimal expansion of) n by one step of the Choix de Bruxelles, version 1 (A323286) operation.

Original entry on oeis.org

1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4, 6, 4, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4, 6, 4, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4, 6, 4, 2, 3, 5, 3, 5, 3, 5, 3, 5, 3, 2, 4, 6, 4, 6, 4, 6, 4
Offset: 1

Views

Author

N. J. A. Sloane, Jan 14 2019

Keywords

Comments

This is the number of terms in row n of the irregular triangle in A323286.
This is one less than the number of different numbers that can be obtained from (the decimal expansion of) n by one step of the Choix de Bruxelles, version 2 (A323460) operation. In other words, this is one less than the number of terms in row n of the irregular triangle in A323460.

Examples

			From 12 we can reach any of 6, 11, 14, 22, 24, so a(12) = 5.
		

Crossrefs

Programs

  • PARI
    a(n, base=10) = { my (d=digits(n, base), s=Set()); for (w=1, #d, for (l=0, #d-w, if (d[l+1], my (h=d[1..l], m=fromdigits(d[l+1..l+w], base), t=d[l+w+1..#d]); s = setunion(s, Set(fromdigits(concat([h,digits(m*2,base),t]), base))); if (m%2==0, s = setunion(s, Set(fromdigits(concat([h,digits(m/2,base),t]), base))))))); #s } \\ Rémy Sigrist, Jan 15 2019
    
  • Python
    def a(n):
        s, out = str(n), set()
        for l in range(1, len(s)+1):
            for i in range(len(s)+1-l):
                if s[i] == '0': continue
                t = int(s[i:i+l])
                out.add(int(s[:i] + str(2*t) + s[i+l:]))
                if t&1 == 0: out.add(int(s[:i] + str(t//2) + s[i+l:]))
        return len(out)
    print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Jul 24 2022

Extensions

More terms from Rémy Sigrist, Jan 15 2019

A323288 Largest number that can be obtained from the "Choix de Bruxelles", version 2 (A323460) operation applied to n.

Original entry on oeis.org

2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 110, 112, 114, 116, 118, 40, 42, 44, 46, 48, 210, 212, 214, 216, 218, 60, 62, 64, 66, 68, 310, 312, 314, 316, 318, 80, 82, 84, 86, 88, 410, 412, 414, 416, 418, 100, 102, 104, 106, 108, 510, 512, 514, 516, 518
Offset: 1

Views

Author

N. J. A. Sloane, Jan 15 2019

Keywords

Comments

Equally, this is the largest number that can be obtained from the "Choix de Bruxelles", version 1 (A323286) operation applied to n.
Maximal element in row n of irregular triangle in A323460 (or, equally, A323286).
Conjecture: If n contains no digit >= 5, then a(n) = 2*n; otherwise, a(n) is obtained from n by doubling the substring from the last digit >= 5 to the last digit. - Charlie Neder, Jan 19 2019. (This is true. - N. J. A. Sloane, Jan 22 2019)
Corollary: a(n)/n < 10 for all n, and a(n) = 10 - 1/k + O(1/k^2) for n = 10*k+5. - N. J. A. Sloane, Jan 23 2019
The high-water marks for a(n)/n occur at n = 1,15,25,35,45,..., cf. A017329. - N. J. A. Sloane, Jan 23 2019

Crossrefs

Programs

  • PARI
    a(n, base=10) = { my (d=digits(n, base), v=2*n); for (w=1, #d, for (l=0, #d-w, if (d[l+1], my (h=d[1..l], m=fromdigits(d[l+1..l+w], base), t=d[l+w+1..#d]); v = max(v, fromdigits(concat([h,digits(m*2,base),t]), base))))); v } \\ Rémy Sigrist, Jan 15 2019
    
  • Python
    def a(n):
        s, out = str(n), {n}
        for l in range(1, len(s)+1):
            for i in range(len(s)+1-l):
                if s[i] == '0': continue
                t = int(s[i:i+l])
                out.add(int(s[:i] + str(2*t) + s[i+l:]))
                if t&1 == 0: out.add(int(s[:i] + str(t//2) + s[i+l:]))
        return max(out)
    print([a(n) for n in range(1, 60)]) # Michael S. Branicky, Jul 24 2022

Formula

a(n) >= 2*n. - Rémy Sigrist, Jan 15 2019

Extensions

More terms from Rémy Sigrist, Jan 15 2019

A323484 Minimal number of steps to reach 5*n from 5 using "Choix de Bruxelles" version 2 (cf. A323460).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Jan 16 2019

Keywords

Comments

This is equally the minimal number of steps to reach 5*n from 5 using "Choix de Bruxelles" version 1 (cf. A323286). - N. J. A. Sloane, Jan 24 2019
The sequence is well defined as we can reach any multiple of 5 starting from 5.

Crossrefs

A358708 Starting from 1, successively take the smallest "Choix de Bruxelles" (A323286) which is not already in the sequence.

Original entry on oeis.org

1, 2, 4, 8, 16, 13, 23, 26, 46, 43, 83, 86, 166, 133, 136, 68, 34, 17, 27, 47, 87, 167, 137, 174, 172, 171, 271, 272, 236, 118, 19, 29, 49, 89, 169, 139, 178, 278, 239, 269, 469, 439, 478, 474, 237, 267, 467, 437, 837, 867, 1667, 1337, 1367, 687, 347, 177, 277, 477, 877, 1677, 1377, 1747, 1727, 1717, 1734, 1732, 866, 433, 233, 263, 163, 323, 313, 316, 38, 76, 73, 143, 123, 63, 33, 36, 18, 9
Offset: 0

Views

Author

Alon Vinkler, Nov 26 2022

Keywords

Comments

The Choix de Bruxelles doubles or halves some decimal digit substring and rows of A323286 are all ways this can be done.
So a(n) is the smallest term of the row a(n-1) of A323286 which is not among {a(0..n-1)}.
The sequence is finite since having reached 18 -> 9 the sole Choix for 9 would be back to 18, which is already in the sequence.

Examples

			Below, square brackets [] represent multiplication by 2 (e.g., [6] = 12); curly brackets {} represent division by 2 (e.g., {6} = 3); digits outside the brackets are not affected by the multiplication or division (e.g., 1[6] = 112 and 1{14} = 17).
We begin with 1 and, at each step, we go to the smallest number possible that hasn't yet appeared in the sequence:
 1 --> [1]  =  2
 2 --> [2]  =  4
 4 --> [4]  =  8
 8 --> [8]  = 16
 16 --> 1{6} = 13
 13 --> [1]3 = 23
 23 --> 2[3] = 26
 26 --> [2]6 = 46
 ... and so on.
		

Crossrefs

A360190 Starting from 1, successively take the smallest "Choix de Bruxelles" with factor 13 which is not already in the sequence.

Original entry on oeis.org

1, 13, 133, 1333, 13333, 133333, 1333333, 125641, 1256413, 12564133, 1197241, 117481, 9037, 90391, 9031, 90313, 903133, 90241, 902413, 9024133, 90241333, 6941641, 693241, 6932413, 69324133, 6717241, 671557, 65557, 5557, 55591, 5431, 54313, 543133, 54241
Offset: 0

Views

Author

Alon Vinkler, Jan 29 2023

Keywords

Comments

At a given term t, the Choix de Bruxelles with factor 13 can choose to multiply any decimal digit substring (not starting 0) of t by 13, or divide by 13 if that substring is divisible by 13.
These choices on substrings give various possible next values and here take the smallest not yet in the sequence.
The sequence is finite and ends at a(6851) = 7, since the sole next Choix there is multiplication by 13 to 91, but 91 is already in the sequence at the preceding a(6850) = 91.

Examples

			Below, square brackets [] represent multiplication by 13 (e.g., [4] = 52); curly brackets {} represent division by 13 (e.g., {26} = 2); digits outside the brackets are not affected by the multiplication or division (e.g., 1[3] = 139 and 1{169} = 113).
We begin with 1 and, at each step, we go to the smallest number possible that hasn't yet appeared in the sequence:
 1 --> [1] = 13
 13 --> [1]3 = 133
 133 --> [1]33 = 1333
 1333 --> [1]333 = 13333
 13333 --> [1]3333 = 133333
 133333 --> [1]33333 = 1333333
 1333333 --> 1{333333} = 125641
 ... and so on.
		

Crossrefs

Cf. A358708 (steps by factor 2), A323286 (Choix with factor 2).
Showing 1-10 of 17 results. Next