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.

Previous Showing 21-30 of 72 results. Next

A367635 Variation of the "Comma sequence" A121805: allow one or more digits from both a(n-1) and a(n) to form the magnitude of the difference |a(n) - a(n-1)|, always choosing the minimum possible distinct value for a(n).

Original entry on oeis.org

1, 12, 35, 94, 135, 78, 159, 63, 30, 15, 72, 48, 129, 36, 399, 306, 244, 202, 181, 170, 85, 32, 6, 73, 104, 59, 150, 75, 23, 58, 139, 45, 499, 405, 352, 76, 8, 97, 25, 83, 49, 140, 70, 64, 22, 46, 107, 34, 82, 57, 128, 44, 2, 24, 71, 56, 117, 43, 81, 65, 14, 60, 55, 106, 42, 20, 10, 5, 61, 47
Offset: 1

Views

Author

Scott R. Shannon, Nov 25 2023

Keywords

Comments

The sequence is finite; after 206 terms 9 is reached which only has one possible following term 100, but 100 has already appeared. The largest difference between terms is 910, from a(151) = 99 to a(152) = 1009, the later being the largest term of the sequence.

Examples

			a(6) = 78 as a(5) = 135, and |78 - 135| = 57 which can be formed from one digit of 135 and one digit of 78.
a(15) = 399 as a(14) = 36, and |399 - 36| = 363 which can be formed from two digits of 36 and one digit of 399. This is the first term whose difference with the previous term uses more than two digits.
		

Crossrefs

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

A367345 Compute the commas sequence starting at 1, as in A121805, except do the calculations in hexadecimal. The terms are written here in decimal.

Original entry on oeis.org

1, 18, 53, 141, 350, 576, 578, 612, 678, 777, 924, 1120, 1124, 1192, 1325, 1539, 1593, 1743, 1990, 2094, 2327, 2448, 2457, 2611, 2669, 2888, 3027, 3087, 3340, 3545, 3703, 3829, 3924, 4003, 4066, 4099, 4148, 4213, 4294, 4391, 4504, 4633, 4778, 4939, 5116, 5309, 5518
Offset: 1

Views

Author

N. J. A. Sloane, Nov 15 2023, following a suggestion from William Cheswick

Keywords

Comments

When written in hexadecimal the terms are 1, 12, 35, 8D, 15E, 240, 242, 264, 2A6, 309, 39C, 460, 464, 4A8, 52D, 603, 639, 6CF, 7C6, 82E, 917, 990, 999, A33, A6D, B48, BD3, C0F, D0C, DD9, ...
Finite with last term a(144693554136426354) = 18446744073709551480, which is FFFFFFFFFFFFFF78 in hexadecimal. - Michael S. Branicky, Nov 18 2023

Examples

			See A367344 for examples of similar calculations in base 8.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy.ntheory.factor_ import digits
    def agen(b=16): # generator of terms
        an, y = 1, 1
        while y < b:
            yield an
            an, y = an + b*(an%b), 1
            while y < b:
                if str(digits(an+y, b)[1]) == str(y):
                    an += y
                    break
                y += 1
    print(list(islice(agen(), 50))) # Michael S. Branicky, Nov 16 2023

A367358 Indices k at which either the leading digit or the length of A121805(k) changes.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 8, 11, 13, 17, 19, 21, 22, 24, 45, 69, 90, 107, 127, 145, 164, 185, 204, 422, 614, 822, 1007, 1174, 1392, 1585, 1757, 1943, 4115, 6039, 8123, 9974, 11641, 13814, 15738, 17822, 19673, 41413, 60643, 81477, 99995, 114281, 132138, 151369, 172201, 190720, 408111, 646206, 854539, 1039724, 1373058, 1551630, 1743937, 1952271
Offset: 1

Views

Author

N. J. A. Sloane, Nov 21 2023

Keywords

Crossrefs

Programs

  • Python
    def agen(): # generator of terms
        n, an, y, prev_lead, prev_length = 1, 1, 1, None, None
        while y < 10:
            san = str(an)
            lead, length = san[0], len(san)
            if lead != prev_lead or length != prev_length:
                yield n
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
            n, prev_lead, prev_length = n+1, lead, length
    print(list(agen())) # Michael S. Branicky, Nov 22 2023

Extensions

More terms from Michael S. Branicky, Nov 22 2023

A367359 Value of A121805(k) for k = A367358(n).

Original entry on oeis.org

1, 12, 35, 94, 135, 248, 331, 461, 530, 651, 744, 809, 908, 1068, 2070, 3039, 4093, 5012, 6013, 7042, 8026, 9055, 10058, 20047, 30092, 40017, 50008, 60054, 70063, 80065, 90022, 100058, 200051, 300060, 400093, 500028, 600074, 700013, 800022, 900055, 1000006, 2000047, 3000008, 4000061, 5000034, 6000055, 7000008, 8000056, 9000013, 10000036, 20000038, 30000029, 40000039, 50000030, 60000051, 70000064, 80000064, 90000077
Offset: 1

Views

Author

N. J. A. Sloane, Nov 21 2023

Keywords

Comments

These are the terms in A121805 where either the leading digit or the length has just changed.

Crossrefs

Programs

  • Python
    def agen(): # generator of terms
        n, an, y, prev_lead, prev_length = 1, 1, 1, None, None
        while y < 10:
            san = str(an)
            lead, length = san[0], len(san)
            if lead != prev_lead or length != prev_length:
                yield an
            an, y = an + 10*(an%10), 1
            while y < 10:
                if str(an+y)[0] == str(y):
                    an += y
                    break
                y += 1
            n, prev_lead, prev_length = n+1, lead, length
    print(list(agen())) # Michael S. Branicky, Nov 22 2023

Extensions

More than the usual number of terms are shown in order to match the data in A367358.
More terms from Michael S. Branicky, Nov 22 2023

A367604 Length 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, 17, 2, 1259, 3243760, 33779, 8367, 3, 2137453, 29347, 4, 27, 3097837317, 75455289096, 144693554136426354, 586, 8250248375768635503445567685, 4956282, 51496560713, 7977231, 4, 560002, 48, 779641, 10712620148411, 44948082868036315658034347512222651
Offset: 2

Views

Author

N. J. A. Sloane, Dec 08 2023

Keywords

Crossrefs

Cf. A121805, A367605 (last term).
The sequences for bases 3, 8, and 10 are A367355, A367344, and A121805.

Extensions

More terms from Michael S. Branicky, Dec 08 2023

A368356 Numbers k such that A121805(k) is prime.

Original entry on oeis.org

8, 11, 21, 23, 35, 39, 75, 90, 91, 92, 95, 96, 105, 106, 112, 116, 122, 131, 133, 135, 140, 146, 156, 158, 205, 217, 219, 225, 235, 243, 247, 265, 277, 307, 315, 343, 349, 369, 373, 375, 409, 417, 422, 430, 433, 434, 435, 438, 447, 448, 450, 459, 464, 465, 474, 477, 479, 482, 490, 492, 498, 504, 509, 513, 520, 522
Offset: 1

Views

Author

N. J. A. Sloane, Dec 22 2023

Keywords

Comments

Suggested by a comparison of A121805 and the Fibonacci sequence A000045. Both sequence involve the "additive theory of primes".

Crossrefs

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

A367360 Comma transform of squares.

Original entry on oeis.org

1, 14, 49, 91, 62, 53, 64, 96, 48, 11, 1, 11, 41, 91, 62, 52, 62, 93, 43, 14, 4, 14, 45, 95, 66, 56, 67, 97, 48, 19, 9, 11, 41, 91, 61, 51, 61, 91, 41, 11, 1, 11, 41, 91, 62, 52, 62, 92, 42, 12, 2, 12, 42, 92, 63, 53, 63, 93, 43, 13, 3, 13, 43, 94, 64, 54, 64, 94, 44, 14, 5, 15, 45, 95, 65, 55, 65, 96, 46, 16, 6, 16, 46, 97
Offset: 0

Views

Author

N. J. A. Sloane, Nov 22 2023

Keywords

Comments

To compute the comma transform of a sequence [b,c,d,e,f,...], concatenate the last digit of each term with the first digit of the following term. In other words, these are the numbers formed by the pairs of digits that surround the commas that separate the terms of the original sequence.
The comma transform CT(S) of a sequence S of positive numbers maps S into the set F consisting of finite or infinite sequences of positive numbers each with one or two digits. The inverse comma transform CTi maps an element of F to an element of F.
Inspired by Eric Angelini's A121805.

Examples

			The squares are 0, 1, 4, 9, 16, 25, ..., so the comma transform is [0]1, 14, 49, 91, 62, ...
		

Crossrefs

A166499 is the comma transform of the primes, A367361 of the powers of 2, A367362 of the nonnegative integers. See also A368362.

Programs

  • Maple
    Maple code for comma transform (CT(a)) of a sequence a:
    # leading digit, from A000030
    Ldigit:=proc(n) local v; v:=convert(n, base, 10); v[-1]; end;
    CT:=proc(a) local b,i; b:=[];
    for i from 1 to nops(a)-1 do
    b := [op(b), 10*(a[i] mod 10) + Ldigit(a[i+1])]; od: b; end;
    # Inverse comma transform of sequence A calculated in base "bas": - N. J. A. Sloane, Jan 03 2024
    bas := 10;
    Ldigit:=proc(n) local v; v:=convert(n, base, bas); v[-1]; end;
    CTi := proc(A) local B,i,L,R;
    for i from 1 to nops(A) do
       if A[i]>=bas^2 then error("all terms must have 1 or 2 digits"); fi; od:
    B:=Array(1..nops(A),-1);
    if A[1] >= bas then B[1]:= Ldigit(A[1]); L:=(A[1] mod bas);
    else B[1]:=10; L:=A[1];
    fi;
    for i from 2 to nops(A) do
      if A[i] >= bas then R := Ldigit(A[i]) else R:=0; fi;
      B[i] := L*bas + R;
      L := (A[i] mod bas);
    od;
    B;
    end;
    # second Maple program:
    a:= n-> parse(cat(""||(n^2)[-1],""||((n+1)^2)[1])):
    seq(a(n), n=0..99);  # Alois P. Heinz, Nov 22 2023
  • Mathematica
    a[n_]:=FromDigits[{Last[IntegerDigits[n^2]],First[IntegerDigits[(n+1)^2]]}];
    a/@Range[0,83] (* Ivan N. Ianakiev, Nov 24 2023 *)
  • Python
    from itertools import count, islice, pairwise
    def S(): yield from (str(i**2) for i in count(0))
    def agen(): yield from (int(t[-1]+u[0]) for t, u in pairwise(S()))
    print(list(islice(agen(), 84))) # Michael S. Branicky, Nov 22 2023
    
  • Python
    def A367360(n): return (0, 10, 40, 90, 60, 50, 60, 90, 40, 10)[n%10]+int(str((n+1)**2)[0]) # Chai Wah Wu, Dec 22 2023

Formula

a(n) = 10 * A008959(n) + A002993(n+1). - Alois P. Heinz, Nov 22 2023
Previous Showing 21-30 of 72 results. Next