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 20 results. Next

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

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

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

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

A323465 Irregular triangle read by rows: row n lists the numbers that can be obtained from the binary expansion of n by either deleting a single 0, or inserting a single 0 after any 1, or doing nothing.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Jan 26 2019

Keywords

Comments

All the numbers in row n have the same binary weight (A000120) as n.
If k appears in row n, n appears in row k.
If we form a graph on the positive integers by joining k to n if k appears in row n, then there is a connected component for each weight 1, 2, ...
The largest number in row n is 2n.
The smallest number in the component containing n is 2^A000120(n)-1, and n is reachable from 2^A000120(n)-1 in A023416(n) steps. - Rémy Sigrist, Jan 26 2019

Examples

			From 6 = 110 we can get 6 = 110, 11 = 3, 1010 = 10, or 1100 = 12, so row 6 is {3,6,10,12}.
From 7 = 111 we can get 7 = 111, 1011 = 11, 1101 = 13, or 1110 = 14, so row 7 is {7,11,13,14}.
The triangle begins:
   1,  2;
   1,  2,  4;
   3,  5,  6;
   2,  4,  8;
   3,  5,  9, 10;
   3,  6, 10, 12;
   7, 11, 13, 14;
   4,  8, 16;
   5,  9, 17, 18;
   5,  6, 10, 18, 20;
   7, 11, 19, 21, 22;
   6, 12, 20, 24;
   7, 13, 21, 25, 26;
   7, 14, 22, 26, 28;
  15, 23, 27, 29, 30;
   8, 16, 32;
  ...
		

Crossrefs

Cf. A000120, A323286, A323455, A323456, A323466 (number of terms in each row), A323467 (minimal number in each row).
This is a base-2 analog of A323460.

Programs

  • Mathematica
    r323465[n_] := Module[{digs=IntegerDigits[n, 2]} ,Map[FromDigits[#, 2]&, Union[Map[Insert[digs, 0, #+1]&, Flatten[Position[digs, 1]]], Map[Drop[digs, {#}]&, Flatten[Position[digs, 0]]], {digs}]]] (* nth row *)
    a323465[{m_, n_}] := Flatten[Map[r323465, Range[m, n]]]
    a323465[{1, 22}] (* Hartmut F. W. Hoft, Oct 24 2023 *)

Extensions

More terms from Rémy Sigrist, Jan 27 2019

A337321 a(n) is the least number of steps required to reach 1 starting from n under substring substitutions of the form k <-> prime(k) (where prime(k) denotes the k-th prime number).

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Aug 23 2020

Keywords

Comments

This sequence is a variant of "Choix de Bruxelles" (where we consider substring substitutions of the form k <-> 2*k, see A323286):
- we map a positive number n to any number that can be obtained as follows:
- take a nonempty substring s (without leading zero) in the decimal representation of n,
- if the value of s corresponds to a prime number, say the k-th prime number, then replace s by k or by prime(s),
- otherwise replace s by prime(s).
For example, the number 17 can be mapped to any of those values:
- 27 (by replacing the leading 1 by prime(1) = 2),
- 14 (by replacing the trailing 7 = prime(4) by 4),
- 117 (by replacing the trailing 7 by prime(7) = 17),
- 7 (by replacing 17 = prime(7) by 7),
- 59 (by replacing 17 by prime(17) = 59).
This sequence is well defined:
- the sequence is well defined for any number <= 11 by considering the following (minimal) paths:
1
2 -> 1
3 -> 2 -> 1
4 -> 7 -> 17 -> 27 -> 37 -> 12 -> 11 -> 5 -> 3 -> 2 -> 1
5 -> 3 -> 2 -> 1
6 -> 13 -> 12 -> 11 -> 5 -> 3 -> 2 -> 1
7 -> 17 -> 27 -> 37 -> 12 -> 11 -> 5 -> 3 -> 2 -> 1
8 -> 19 -> 67 -> 137 -> 127 -> 31 -> 11 -> 5 -> 3 -> 2 -> 1
9 -> 23 -> 13 -> 12 -> 11 -> 5 -> 3 -> 2 -> 1
10 -> 20 -> 71 -> 41 -> 13 -> 12 -> 11 -> 5 -> 3 -> 2 -> 1
11 -> 5 -> 3 -> 2 -> 1
- so for any number n:
- we can transform any of its nonzero digit > 1 into a digit 1,
- once we have a number with only 1's and 0's:
- while this number is > 1, it either starts with "10" or with "11",
and we can transform this prefix into a "1",
- and eventually we will reach 1.

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(prime(n)) <= 1 + a(n).

A342072 Lexicographically earliest sequence of distinct positive numbers such that for any n > 0, a(n+1) can be obtained by replacing in the decimal representation of a(n) some nonempty substring m (without leading zero) by a divisor of m or by a positive multiple of m.

Original entry on oeis.org

1, 2, 4, 8, 16, 11, 12, 3, 6, 18, 9, 27, 17, 34, 14, 7, 21, 22, 24, 28, 48, 41, 42, 44, 84, 81, 82, 86, 26, 13, 19, 29, 23, 43, 46, 92, 32, 31, 33, 36, 66, 61, 62, 64, 68, 38, 76, 71, 72, 74, 37, 67, 127, 47, 87, 167, 117, 39, 69, 63, 123, 113, 111, 112, 56
Offset: 1

Views

Author

Rémy Sigrist, Feb 27 2021

Keywords

Comments

The procedure used to generate the terms of this sequence has similarities with that described in A323286 (Choix de Bruxelles); however here, we don't limit ourselves to divide or multiply by two.
Apparently, all positive integers appear in this sequence.
Multiples of 5 are clustered.

Examples

			The first terms, alongside the substitution that gives a(n+1), are:
  n   a(n)  a(n+1)
  --  ----  ------
   1     1   (1*2)
   2     2   (2*2)
   3     4   (4*2)
   4     8   (8*2)
   5    16  1(6/6)
   6    11  1(1*2)
   7    12  (12/4)
   8     3   (3*2)
   9     6   (6*3)
  10    18  (18/2)
  11     9   (9*3)
  12    27  (2/2)7
  13    17  (17*2)
  14    34  (3/3)4
  15    14  (14/2)
		

Crossrefs

Cf. A323286.

Programs

  • PARI
    See Links section.
Showing 1-10 of 20 results. Next