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

A367338 Comma-successor to n: second term of commas sequence if initial term is n, or -1 if there is no second term.

Original entry on oeis.org

12, 24, 36, 48, 61, 73, 85, 97, 100, 11, 23, 35, 47, 59, 72, 84, 96, -1, 110, 22, 34, 46, 58, 71, 83, 95, -1, 109, 120, 33, 45, 57, 69, 82, 94, -1, 108, 119, 130, 44, 56, 68, 81, 93, -1, 107, 118, 129, 140, 55, 67, 79, 92, -1, 106, 117, 128, 139, 150, 66, 78, 91, -1, 105, 116
Offset: 1

Views

Author

N. J. A. Sloane, Nov 15 2023

Keywords

Comments

Construct the commas sequence as in A121805, but take the first term to be n. Then a(n), the comma-successor to n, is the second term, or -1 if no second term exists.
More generally, we define a comma-child of n to be any number m with the property that m-n = 10*x+y, where x is the least significant digit of n and y is the most significant digit of m.
A positive number can have 0, 1, or 2 comma-children. In accordance with the Law of Primogeniture, the first-born child (i.e. the smallest), if there is one, is the comma-successor.
Comment from N. J. A. Sloane, Nov 19 2023: (Start)
The following is a proof of a slight modification of a conjecture made by Ivan N. Ianakiev in A367341.
The Comma-Successor Theorem.
Let D(b) denote the set of numbers k which have no comma-successor in base b ("comma-successor" is the base-b generalization of the rule that defines A121805). If a commas sequence reaches a number in D(b) it will end there.
Then D(b) consists precisely of the numbers which when written in base b have the form
cc...cxy = (b^i-1)*b^2/(b-1) + b*x + y,
with i >= 0 copies of c = b-1, where x and y are in the range [1..b-2] and satisfy x+y = b-1. .... (*)
For b = 10 the numbers D(10) are listed in A367341.
For an outline of the proof, see the attached text-file.
Note that in base b = 2, no values of x satisfying (*) exist, and the theorem asserts that D(2) is empty. In fact it is easy to check directly that every commas sequence in base 2 is infinite. If the initial term is 0 or 1 mod 4 then the sequence will merge with A042948, and if the initial term is 2 or 3 mod 4 then the sequence will merge with A042964.
(End)

Examples

			a(1) = A121803(2) = 12,
a(2) = A139284(2) = 24,
a(3) = 36, since the full commas sequence starting with 3 is [3, 36] (which also implies a(36) = -1),
a(4) = A366492(2) = 48, and so on.
60 is the first number that is a comma-child (a member of A367312) but is missing from the present sequence (it is a comma-child but not a comma-successor, since it loses out to 59).
		

Crossrefs

A367346 lists those n for which there is more than one choice for the second term.
A367612 lists the numbers that are comma-children of some number k.

Programs

  • Maple
    Ldigit:=proc(n) local v; v:=convert(n, base, 10); v[-1]; end;
    A367338 := proc(n) local f,i,d;
    f := (n mod 10);
    d:=10*f;
    for i from 1 to 9 do
    d := d+1;
    if Ldigit(n+d) = i then return(n+d); fi;
    od:
    return(-1);
    end;
    for n from 1 to 50 do lprint(n, A367338(n)); od: # N. J. A. Sloane, Dec 06 2023
  • Mathematica
    a[n_] := a[n] = Module[{l = n, y = 1, d}, While[y < 10, l = l + 10*(Mod[l, 10]); y = 1; While[y < 10, d = IntegerDigits[l + y][[1]]; If[d == y, l = l + y; Break[];]; y++;]; If[y < 10, Return[l]];]; Return[-1];];
    Table[a[n], {n, 1, 65}] (* Robert P. P. McKone, Dec 18 2023 *)
  • Python
    from itertools import islice
    def a(n):
        an, y = n, 1
        while y < 10:
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
            if y < 10:
                return an
        return -1
    print([a(n) for n in range(1, 66)]) # Michael S. Branicky, Nov 15 2023

A367339 a(n) = A367338(n) - n, or -1 if A367338(n) = -1.

Original entry on oeis.org

11, 22, 33, 44, 56, 67, 78, 89, 91, 1, 12, 23, 34, 45, 57, 68, 79, -1, 91, 2, 13, 24, 35, 47, 58, 69, -1, 81, 91, 3, 14, 25, 36, 48, 59, -1, 71, 81, 91, 4, 15, 26, 38, 49, -1, 61, 71, 81, 91, 5, 16, 27, 39, -1, 51, 61, 71, 81, 91, 6, 17, 29, -1, 41, 51, 61, 71, 81, 91, 7, 18, -1
Offset: 1

Views

Author

N. J. A. Sloane, Nov 15 2023

Keywords

Comments

Construct the commas sequence as in A121805, but take first term to be n. Then a(n) is the two digit number surrounding the first comma, or -1 if there is no second term (and hence no comma).
a(n) (unless it -1) is called the comma-number of n.
As in A121805, if the term before the comma ends in 0, that 0 is ignored and the comma number is a single-digit number.

Examples

			For n = 1, A121805 begins 1, 12, 35, 94, ..., and the first comma appears as 1,1, so a(1) = 11.
For n = 2, A139284 begins 2, 24, 71, 89, ... and the first comma appears as 2,2, so a(2) = 22.
For n = 36, the commas sequence starting at 36 is simply the one-term sequence [36], no second term exists, there is no comma, and so a(36) = -1.
		

Crossrefs

A367340 List of distinct (positive) numbers appearing in A367338.

Original entry on oeis.org

11, 12, 22, 23, 24, 33, 34, 35, 36, 44, 45, 46, 47, 48, 55, 56, 57, 58, 59, 61, 66, 67, 68, 69, 71, 72, 73, 77, 78, 79, 81, 82, 83, 84, 85, 88, 89, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118
Offset: 1

Views

Author

N. J. A. Sloane, Nov 15 2023

Keywords

Comments

This is the list of comma-successors.

Crossrefs

Programs

  • Python
    def cp(n):
        y = int(str(n)[0])
        x = (n-y)%10
        k = n - y - 10*x
        kk = k + 10*x + y-1
        return k if k > 0 and int(str(kk)[0]) != y-1 else -1
    def ok(n): return n > 0 and cp(n) > 0
    print([k for k in range(1, 119) if ok(k)]) # Michael S. Branicky, Dec 18 2023

A367346 Numbers k such that there is more than one possible solution for A367338(k).

Original entry on oeis.org

14, 33, 52, 71, 118, 227, 336, 445, 554, 663, 772, 881, 1918, 2927, 3936, 4945, 5954, 6963, 7972, 8981, 19918, 29927, 39936, 49945, 59954, 69963, 79972, 89981, 199918, 299927, 399936, 499945, 599954, 699963, 799972, 899981, 1999918, 2999927, 3999936, 4999945, 5999954, 6999963, 7999972, 8999981
Offset: 1

Views

Author

N. J. A. Sloane, Nov 15 2023

Keywords

Comments

The number of solutions is either 0, 1, or 2.
The definition of A121805 instructs us to pick the smallest solution, so there is no ambiguity in the definition of A121805. The present sequence shows that there are very few cases where there is any possible ambiguity.
The sequence begins with the four exceptional terms 14, 33, 52, 71. It also includes all numbers with decimal expansions of the form d 9^i d (9-d), where juxtaposition is concatenation, ^ denotes repeated concatenation of digits, 1 <= d <= 8, and i >= 0, with associated next terms in the commas sequence being either d 9^(i+2) or (d+1) 0^(i+2). It is conjectured that there are no other terms. - Michael S. Branicky, Nov 16 2023
The conjecture is true; see link. - Michael S. Branicky, Nov 21 2023

Examples

			In the commas sequence starting at 14, the next term could be either 59 or 60, because both 14,59 and 14,60 satisfy the "commas" rule (since both 14 + 45 = 59 and 14 + 46 = 60).
		

Crossrefs

Programs

  • Mathematica
    fQ[n_]:=Module[{k=n+10*Last[IntegerDigits[n]]+Range[9]},Length[Select[k,#-n==FromDigits[{Last[IntegerDigits[n]],First[IntegerDigits[#]]}]&]]]>1;
    Select[Range[10^6],fQ[#]&] (* Ivan N. Ianakiev, Dec 16 2023 *)

Extensions

a(30) and beyond from Michael S. Branicky, Nov 16 2023
Second comment edited by N. J. A. Sloane, Nov 20 2023

A367606 Comma-successor to n working in base 3, but written in base 10, or -1 if n has no successor.

Original entry on oeis.org

5, 9, 4, -1, 12, 8, 11, 15, 10, 14, 19, 13, 17, 22, 16, 21, 25, 20, 24, 27, 23, -1, 30, 26, 29, 33, 28, 32, 36, 31, 35, 39, 34, 38, 42, 37, 41, 45, 40, 44, 48, 43, 47, 51, 46, 50, 55, 49, 53, 58, 52, 57, 61, 56, 60, 64, 59, 63, 67, 62, 66, 70, 65, 69, 73, 68, 72, 76, 71, 75, 79, 74, 78, 81, 77, -1, 84, 80, 83, 87, 82
Offset: 1

Views

Author

N. J. A. Sloane, Dec 11 2023

Keywords

Comments

This is a base-3 analog of A367338.
It seems that the indices of the terms equal to -1 are in A168613. - Ivan N. Ianakiev, Dec 12 2023
This is true for A168613(n), n >= 2. See proofs in A367341. - Michael S. Branicky, Dec 15 2023

Crossrefs

Programs

  • Python
    from sympy.ntheory.factor_ import digits
    def a(n):
        b = n + 3*(n%3)
        return next((b+y for y in [1, 2] if digits(b+y, 3)[1] == y), -1)
    print([a(n) for n in range(1, 82)]) # Michael S. Branicky, Dec 11 2023

A367342 a(n) = n+1 for n = 1 to 8; a(n) = 100 + a(n-8) for n = 9 to 16; thereafter a(8*i+j) = 10^(i+1) + a(8*(i-1)+j) for i >= 2, 1 <= j <= 8.

Original entry on oeis.org

2, 3, 4, 5, 6, 7, 8, 9, 102, 103, 104, 105, 106, 107, 108, 109, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 11102, 11103, 11104, 11105, 11106, 11107, 11108, 11109, 111102, 111103, 111104, 111105, 111106, 111107, 111108, 111109, 1111102, 1111103, 1111104, 1111105, 1111106, 1111107, 1111108, 1111109
Offset: 1

Views

Author

Keywords

Comments

Conjectured to equal A367341(n)/9.

Crossrefs

Cf. A367341.

Programs

Formula

a(n) = ((10^i-1)/9)*100 + j, where i = floor((n-1)/8) and j = (n-1) mod 8 + 2.

A367366 a(n) = smallest k such that the commas sequence (cf. A121805) with initial term k contains n.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 20, 10, 2, 25, 26, 27, 28, 29, 30, 31, 32, 30, 21, 1, 3, 37, 38, 39, 40, 41, 42, 43, 40, 31, 20, 13, 4, 49, 50, 51, 52, 53, 54, 50, 41, 32, 10, 14, 60, 5, 62, 63, 64, 65, 60, 51, 42, 30, 70, 2, 15, 6, 74, 75
Offset: 1

Views

Author

N. J. A. Sloane, Dec 05 2023

Keywords

Comments

Every k >= 1 appears in this sequence exactly A330128(k) times. So there are 2137453 1's, 194697747222394 2's, 2 3's, 209534289952018960 6's, and so on.
a(n) is the most remote ancestor of n in the comma-successor graph.

Examples

			All terms n in A121805 have a(n) = 1, all n in A139284 have a(n) = 2, all n in A366492 have a(n) = 4, and so on.
		

Crossrefs

Programs

  • Python
    def comma_predecessor(n): # A367614(n)
        y = int(str(n)[0])
        x = (n-y)%10
        k = n - y - 10*x
        kk = k + 10*x + y-1
        return k if k > 0 and int(str(kk)[0]) != y-1 else -1
    def a(n):
        an = n
        while (cp:=comma_predecessor(an)) > 0: an = cp
        return an
    print([a(n) for n in range(1, 76)]) # Michael S. Branicky, Dec 18 2023

A367605 Final term of commas sequence (cf. A121805) if start at 1 and do the calculations in base n; or -1 if the sequence is infinite.

Original entry on oeis.org

-1, 76, 6, 15612, 60466165, 823512, 262122, 32, 99999945, 1771460, 110, 2052, 289254654871, 8649755859206, 18446744073709551480, 83264, 1338258845052394702439737982907, 893871504, 10239999999942, 1801088480, 189, 148035426, 13501, 244140456, 3670344486987375
Offset: 2

Views

Author

N. J. A. Sloane, Dec 08 2023

Keywords

Comments

a(n) is written here in base 10. In base n the values are more revealing: they are -1, 2211_3, 12_4, 444422_5, 5555555541_6, 6666624_7, 777752_8, 35_9, and 99999945_10. That is, they consist of a possibly empty string of digits b-1 followed by a pair of digits xy with x+y = b-1 (see the theorem in A367341).

Crossrefs

The sequences for bases 3, 8, and 10 are A367355, A367344, and A121805.

Extensions

More terms from Michael S. Branicky, Dec 08 2023

A367622 Number of comma-children of n in base 10.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
Offset: 1

Views

Author

N. J. A. Sloane, Dec 23 2023

Keywords

Crossrefs

Cf. A121805, A367338 (definition), A367341 (0's), A367346 (2's).

Programs

  • Mathematica
    f[n_]:=Module[{k=n+10*Last[IntegerDigits[n]]+Range[9]},Length[Select[k,#-n==
    FromDigits[{Last[IntegerDigits[n]],First[IntegerDigits[#]]}]&]]]; f/@Range[108] (* Ivan N. Ianakiev, Dec 24 2023 *)
  • Python
    def a(n):
        x = 10*(n%10)
        return len([y for y in range(1, 10) if str(n+x+y)[0] == str(y)])
    print([a(n) for n in range(1, 95)]) # Michael S. Branicky, Dec 23 2023

A367613 Numbers with exactly one comma-child.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17, 19, 20, 21, 22, 23, 24, 25, 26, 28, 29, 30, 31, 32, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 53, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 73, 74, 75, 76, 77, 78, 79, 80, 82, 83
Offset: 1

Views

Author

N. J. A. Sloane, Dec 15 2023

Keywords

Comments

Complement of union of A367341 and A367346.
See A367338 for definition of comma-child.

Crossrefs

Cf. A121895, A367341 (numbers with no comma-children), A367346 (numbers with two comma-children).

Programs

  • Mathematica
    fQ[n_]:=Module[{k=n+10*Last[IntegerDigits[n]]+Range[9]},Length[Select[k,#-n==FromDigits[{Last[IntegerDigits[n]],First[IntegerDigits[#]]}]&]]]==1;
    Select[Range[83],fQ[#]&] (* Ivan N. Ianakiev, Dec 16 2023 *)
  • Python
    def ok(n):
        m = n + 10*(n%10)
        return len([m+y for y in range(1, 10) if int(str(m+y)[0]) == y]) == 1
    print([k for k in range(1, 100) if ok(k)]) # Michael S. Branicky, Dec 28 2023
Showing 1-10 of 12 results. Next