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

A121805 The "comma sequence": the lexicographically earliest sequence of positive numbers with the property that the sequence formed by the pairs of digits adjacent to the commas between the terms is the same as the sequence of successive differences between the terms.

Original entry on oeis.org

1, 12, 35, 94, 135, 186, 248, 331, 344, 387, 461, 475, 530, 535, 590, 595, 651, 667, 744, 791, 809, 908, 997, 1068, 1149, 1240, 1241, 1252, 1273, 1304, 1345, 1396, 1457, 1528, 1609, 1700, 1701, 1712, 1733, 1764, 1805, 1856, 1917, 1988, 2070
Offset: 1

Views

Author

Eric Angelini, Dec 11 2006

Keywords

Comments

An equivalent, but more formal definition, is: a(1) = 1; for n > 1, let x be the least significant digit of a(n-1); then a(n) = a(n-1) + x*10 + y where y is the most significant digit of a(n) and is the smallest such y, if such a y exists. If no such y exists, stop.
The sequence contains exactly 2137453 terms, with a(2137453)=99999945. The next term does not exist. - W. Edwin Clark, Dec 11 2006
It is remarkable that the sequence persists for so long. - N. J. A. Sloane, Dec 15 2006
The similar sequence A139284, which starts at a(1)=2, persists even longer, ending at a(194697747222394) = 9999999999999918. - Giovanni Resta, Nov 30 2019
Conjecture: This sequence is finite, for any initial term. - N. J. A. Sloane, Nov 14 2023
The base 2 analog (suggested by William Cheswick) is 1, 4, 5, 8, 9, 12, 13, ..., (see A042948) with successive differences 3, 1, 3, 1, ... (repeat). - N. J. A. Sloane, Nov 15 2023
Does not satisfy Benford's Law. - Michael S. Branicky, Nov 16 2023
Using the notion of "comma transform" of a sequence, as defined in A367360, this is the lexicographically earliest sequence of positive integers with the property that its first differences and comma transform coincide. - N. J. A. Sloane, Nov 23 2023

Examples

			Replace each comma in the original sequence by the pair of digits adjacent to the comma; the result is the sequence of first differences between the terms of the sequence:
Sequence:   1, 12, 35, 94, 135, 186, 248, 331, 344, 387, 461, 475, ...
Differences: 11, 23, 59, 41 , 51 , 62 , 83 , 13 , 43 , 74 , 14 , ...
To illustrate the formula in the comment: a(6) = 186 and a(7) = 248 = 186 + 62.
		

References

  • Eric Angelini, "Jeux de suites", in Dossier Pour La Science, pp. 32-35, Volume 59 (Jeux math'), April/June 2008, Paris.

Crossrefs

See A366487 and A367349 for first differences.
Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.
Cf. A330128, A330129, A367338 (comma-successor), A367360.
See also A260261, A042948.

Programs

  • Maple
    digits:=n->ListTools:-Reverse(convert(n,base,10)):
    nextK:=proc(K) local i,L; for i from 0 to 9 do L:=K+digits(K)[ -1]*10+i; if i = digits(L)[1] then return L; fi; od; FAIL; end:
    A121805:=proc(n) option remember: if n = 1 then return 1; fi; return nextK(A121805(n-1)); end: # W. Edwin Clark
  • Mathematica
    a[1] = 1; a[n_] := a[n] = For[x=Mod[a[n-1], 10]; y=0, y <= 9, y++, an = a[n-1] + 10*x + y; If[y == IntegerDigits[an][[1]], Return[an]]]; Array[a, 45] (* Jean-François Alcover, Nov 25 2014 *)
  • PARI
    a=1; for(n=1,1000, print1(a", "); a+=a%10*10; for(k=1, 9, digits(a+k)[1]==k&&(a+=k)&&next(2)); error("blocked at a("n")=",a-a%10*10)) \\ M. F. Hasler, Jul 21 2015
    
  • Python
    from itertools import islice
    def agen(): # generator of terms
        an, y = 1, 1
        while y < 10:
            yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
    print(list(islice(agen(), 45))) # Michael S. Branicky, Apr 08 2022
  • R
    A121805 <- data.frame(n=seq(from=1,to=2137453),a=integer(2137453)); A121805$a[1]=1; for (i in seq(from=2,to=2137453)){LSD=A121805$a[i-1] %% 10; k = 1; while (k != as.integer(substring(A121805$a[i-1]+LSD*10+k,1,1))){k = k+1; if(k>9) break} A121805$a[i]=A121805$a[i-1]+LSD*10+k} # Simon Demers, Oct 19 2017
    

Extensions

More terms from Zak Seidov, Dec 11 2006
Edited by N. J. A. Sloane, Sep 17 2023
Changed name from "commas sequence" to "comma sequence". - N. J. A. Sloane, Dec 20 2023

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

A330128 a(n) is the number of terms in the analog of A121805 but starting with n, or -1 if that sequence is infinite.

Original entry on oeis.org

2137453, 194697747222394, 2, 199900, 19706, 209534289952018960, 15, 198104936410, 19511030, 20573, 20572, 2137452, 20534, 19238, 2, 2089707, 20670629294, 1, 21482, 19278442756937613, 2074, 19278442756937612, 20571, 194697747222393, 193, 197062, 1, 197, 2061823
Offset: 1

Views

Author

Giovanni Resta, Dec 02 2019

Keywords

Comments

The final terms of the corresponding sequences are given in A330129.

Crossrefs

Cf. A330129 (corresponding last term), A121805, A139284, A366492.
For record high points see A367364 and A367365.

Programs

  • Mathematica
    nxt[x_] := Block[{p=1, n=x}, While[n >= 10, n = Floor[n/10]; p *= 10]; p (n + 1)]; a[n_] := Block[{nT=1, nX=n, w1, w2, w3, x, it, stp, oX}, stp = 100; w1 = w2 = w3 = 0; While[True, oX = nX; nT++; x = 10*Mod[oX, 10]; nX = SelectFirst[Range[9], IntegerDigits[oX + x + #][[1]] == # &, 0]; If[nX == 0, Break[], nX = nX + oX + x]; If[nT == stp, stp += 100; w1=w2; w2=w3; w3=nX; If[w3 + w1 == 2 w2 && Mod[w3 - w2, 100] == 0, it = Floor[(nxt[nX] - nX - 1)/(w3 - w2)]; nT += it*100; nX += (w3 - w2)*it; w3=nX; stp += it*100]]]; nT - 1]; Array[a, 30]
  • Python
    def nxt(x):
        p, n = 1, x
        while n >= 10:
            n //= 10
            p *= 10
        return p * (n + 1)
    def a(n):
        nT, nX, w1, w2, w3, stp  = 1, n, 0, 0, 0, 100
        while True:
            oX = nX
            nT += 1
            x = 10*(oX%10)
            nX = next((y for y in range(1, 10) if str(oX+x+y)[0] == str(y)), 0)
            if nX == 0: break
            else: nX += oX + x
            if nT == stp:
                stp += 100
                w1, w2, w3 = w2, w3, nX
                if w3 + w1 == 2*w2 and (w3 - w2)%100 == 0:
                    it = (nxt(nX) - nX - 1)//(w3 - w2)
                    nT += it*100
                    nX += (w3 - w2)*it
                    w3 = nX
                    stp += it*100
        return nT - 1
    print([a(n) for n in range(1, 30)]) # Michael S. Branicky, Nov 18 2023 after Giovanni Resta

Extensions

Escape clause added to definition by N. J. A. Sloane, Nov 14 2023

A330129 a(n) is the last term of the analogous sequence to A121805, but with initial term n, or -1 if that sequence is infinite.

Original entry on oeis.org

99999945, 9999999999999918, 36, 9999945, 999945, 9999999999999999936, 936, 9999999999972, 999999936, 999936, 999936, 99999945, 999954, 999918, 72, 99999918, 999999999927, 18, 999981, 999999999999999963, 99981, 999999999999999963, 999936, 9999999999999918, 9963
Offset: 1

Views

Author

Giovanni Resta, Dec 02 2019

Keywords

Comments

The numbers of terms of the corresponding sequences are in A330128.

Crossrefs

Programs

  • Mathematica
    nxt[x_] := Block[{p=1, n=x}, While[n >= 10, n = Floor[n/10]; p *= 10]; p (n + 1)]; a[n_] := Block[{nT=1, nX=n, w1, w2, w3, x, it, stp, oX}, stp = 100; w1 = w2 = w3 = 0; While[True, oX = nX; nT++; x = 10*Mod[oX, 10]; nX = SelectFirst[Range[9], IntegerDigits[oX + x + #][[1]] == # &, 0]; If[nX == 0, Break[], nX = nX + oX + x]; If[nT == stp, stp += 100; w1=w2; w2=w3; w3=nX; If[w3 + w1 == 2 w2 && Mod[w3 - w2, 100] == 0, it = Floor[(nxt[nX] - nX - 1)/(w3 - w2)]; nT += it*100; nX += (w3 - w2)*it; w3=nX; stp += it*100]]]; oX]; Array[a, 30]
  • Python
    def nxt(x):
        p, n = 1, x
        while n >= 10:
            n //= 10
            p *= 10
        return p * (n + 1)
    def a(n):
        nT, nX, w1, w2, w3, stp  = 1, n, 0, 0, 0, 100
        while True:
            oX = nX
            nT += 1
            x = 10*(oX%10)
            nX = next((y for y in range(1, 10) if str(oX+x+y)[0] == str(y)), 0)
            if nX == 0: break
            else: nX += oX + x
            if nT == stp:
                stp += 100
                w1, w2, w3 = w2, w3, nX
                if w3 + w1 == 2*w2 and (w3 - w2)%100 == 0:
                    it = (nxt(nX) - nX - 1)//(w3 - w2)
                    nT += it*100
                    nX += (w3 - w2)*it
                    w3 = nX
                    stp += it*100
        return oX
    print([a(n) for n in range(1, 30)]) # Michael S. Branicky, Nov 18 2023 after Giovanni Resta

Extensions

Escape clause added to definition by N. J. A. Sloane, Nov 14 2023

A366492 Analog of A121805, but starting with 4.

Original entry on oeis.org

4, 48, 129, 221, 233, 265, 318, 402, 426, 490, 494, 539, 635, 691, 708, 795, 853, 891, 910, 919, 1010, 1011, 1022, 1043, 1074, 1115, 1166, 1227, 1298, 1379, 1470, 1471, 1482, 1503, 1534, 1575, 1626, 1687, 1758, 1839, 1930, 1931, 1942, 1963, 1994, 2036, 2098, 2180, 2182
Offset: 1

Views

Author

N. J. A. Sloane, Nov 14 2023

Keywords

Comments

If instead we start with 3, the sequence is the two-term sequence [3, 36].
The present sequence is finite, with last term a(199900) = 9999945.

Crossrefs

Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.

Programs

  • Python
    from itertools import islice
    def agen(start=4): # generator of terms
        an, y = start, 1
        while y < 10:
            yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
    print(list(islice(agen(), 50))) # Michael S. Branicky, Nov 18 2023

A367337 Analog of A121805, but starting with 5.

Original entry on oeis.org

5, 61, 78, 159, 251, 263, 295, 348, 432, 456, 521, 536, 602, 628, 715, 772, 799, 897, 976, 1037, 1108, 1189, 1280, 1281, 1292, 1313, 1344, 1385, 1436, 1497, 1568, 1649, 1740, 1741, 1752, 1773, 1804, 1845, 1896, 1957, 2029, 2121, 2133, 2165, 2217, 2289, 2381, 2393, 2425
Offset: 1

Views

Author

N. J. A. Sloane, Nov 14 2023

Keywords

Comments

This sequence is finite, with last term a(19706) = 999945.

Crossrefs

Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.

Programs

  • Python
    from itertools import islice
    def agen(start=5): # generator of terms
        an, y = start, 1
        while y < 10:
            yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
    print(list(agen())) # Michael S. Branicky, Nov 18 2023

A367350 Analog of A121805, but starting with 6.

Original entry on oeis.org

6, 73, 104, 145, 196, 258, 341, 354, 397, 471, 485, 540, 545, 601, 617, 693, 730, 737, 815, 873, 912, 941, 960, 969, 1060, 1061, 1072, 1093, 1124, 1165, 1216, 1277, 1348, 1429, 1520, 1521, 1532, 1553, 1584, 1625, 1676, 1737, 1808, 1889, 1980, 1981, 1992, 2014, 2056, 2118
Offset: 1

Views

Author

N. J. A. Sloane, Nov 17 2023

Keywords

Comments

Contains 209534289952018960 terms, the last term being a(209534289952018960) = 9999999999999999936.

Crossrefs

Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.

Programs

  • Mathematica
    b = 10; m = b - 1; a[1] = 6; a[n_] := a[n] = For[r = Mod[a[n - 1], b]; y = 0, y <= m, y++, If[y == IntegerDigits[#, b][[1]], Return[#]] &[a[n - 1] + b r + y]]; Array[a, 45] (* Michael De Vlieger, Nov 18 2023, after Jean-François Alcover at A121805 *)
  • Python
    from itertools import count, islice
    def agen(start=6): # generator of terms
        an, y = start, 1
        while y < 10:
            yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
    print(list(islice(agen(), 50))) # Michael S. Branicky, Nov 18 2023

A367351 Analog of A121805, but starting with 7.

Original entry on oeis.org

7, 85, 136, 197, 269, 362, 385, 439, 534, 579, 675, 732, 759, 857, 936
Offset: 1

Views

Author

N. J. A. Sloane, Nov 17 2023

Keywords

Crossrefs

Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.

Programs

  • Mathematica
    b = 10; m = b - 1; a[1] = 7; a[n_] := a[n] = For[r = Mod[a[n - 1], b]; y = 0, y <= m, y++, If[y == IntegerDigits[#, b][[1]], Return[#]] &[a[n - 1] + b r + y]]; TakeWhile[Array[a, 45], IntegerQ] (* Michael De Vlieger, Nov 18 2023, after Jean-François Alcover at A121805 *)
  • Python
    def agen(start=7): # generator of terms
        an, y = start, 1
        while y < 10:
            yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
    print(list(agen())) # Michael S. Branicky, Nov 18 2023

A367352 Analog of A121805, but starting with 8.

Original entry on oeis.org

8, 97, 168, 250, 252, 274, 317, 390, 393, 427, 502, 527, 603, 639, 736, 804, 852, 880, 888, 977, 1048, 1129, 1220, 1221, 1232, 1253, 1284, 1325, 1376, 1437, 1508, 1589, 1680, 1681, 1692, 1713, 1744, 1785, 1836, 1897, 1968, 2050, 2052, 2074, 2116, 2178, 2260, 2262, 2284
Offset: 1

Views

Author

N. J. A. Sloane, Nov 17 2023

Keywords

Comments

Contains 198104936410 terms, the last being 9999999999972.

Crossrefs

Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.

Programs

  • Mathematica
    b = 10; m = b - 1; a[1] = 8; a[n_] := a[n] = For[r = Mod[a[n - 1], b]; y = 0, y <= m, y++, If[y == IntegerDigits[#, b][[1]], Return[#]] &[a[n - 1] + b r + y]]; Array[a, 45] (* Michael De Vlieger, Nov 18 2023, after Jean-François Alcover at A121805 *)
  • Python
    from itertools import islice
    def agen(start=8): # generator of terms
        an, y = start, 1
        while y < 10:
            yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
    print(list(islice(agen(), 50))) # Michael S. Branicky, Nov 18 2023

A367353 Analog of A121805, but starting with 9.

Original entry on oeis.org

9, 100, 101, 112, 133, 164, 206, 268, 351, 364, 408, 492, 517, 592, 618, 705, 762, 789, 887, 966, 1027, 1098, 1179, 1270, 1271, 1282, 1303, 1334, 1375, 1426, 1487, 1558, 1639, 1730, 1731, 1742, 1763, 1794, 1835, 1886, 1947, 2019, 2111, 2123, 2155, 2207, 2279, 2371
Offset: 1

Views

Author

N. J. A. Sloane, Nov 17 2023

Keywords

Comments

Contains 19511030 terms, the last being 999999936.

Crossrefs

Comma sequences in base 10, starting with 1, 2, 4, 5, 6, 7, 8, 9, 10 are A121805, A139284, A366492, A367337, A367350, A367351, A367352, A367353, A367354. Starting with 3 is trivial, and those starting with 11, 12, 13 are essentially duplicates.

Programs

  • Mathematica
    b = 10; m = b - 1; a[1] = 9; a[n_] := a[n] = For[r = Mod[a[n - 1], b]; y = 0, y <= m, y++, If[y == IntegerDigits[#, b][[1]], Return[#]] &[a[n - 1] + b r + y]]; Array[a, 45] (* Michael De Vlieger, Nov 18 2023, after Jean-François Alcover at A121805 *)
  • Python
    from itertools import islice
    def agen(start=9): # generator of terms
        an, y = start, 1
        while y < 10:
            yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
    print(list(islice(agen(), 50))) # Michael S. Branicky, Nov 18 2023
Showing 1-10 of 14 results. Next