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-4 of 4 results.

A361350 A variant of A359143 which includes the intermediate terms before digits are deleted (see Comments for precise definition).

Original entry on oeis.org

11, 112, 1124, 11248, 1124816, 2486, 248620, 4860, 486018, 48601827, 4860182736, 486018273645, 8601827365, 860182736546, 86018273654656, 8601827365465667, 860182736546566780, 601273654656670, 60127365465667064, -1273545704, -127354570438, -12735457043849, -1273545704384962, -127354570438496270, 1273545743849627, 127354574384962777, 12735457438496277791, 273545743849627779
Offset: 0

Views

Author

N. J. A. Sloane, Mar 16 2023

Keywords

Comments

This is essentially the same sequence as A359143 (so this too is a finite sequence), the difference being that it includes the terms before any digits are cancelled. Let S be the digit string of a(n), replacing a minus sign if present by 0.
Let T = S concatenated with the digit-sum of S.
If the leading digit of T is not present in the digit-sum of S, then a(n+1) = A359142(T), as in A359143.
If the leading digit of T is present in the digit-sum of S, then we add two new terms instead of one: a(n+1) = a(n) concatenated with the digit-sum of S, and a(n+2) = A359142(T), as in A359143.

Examples

			The digit strings for the initial terms are:
  11,
  112,
  1124,
  11248,
  1124816,
  2486,
  248620,
  4860,
  486018,
  48601827,
  4860182736,
  486018273645,
  8601827365,
  860182736546,
  86018273654656,
  8601827365465667,
  860182736546566780,
  601273654656670,
  60127365465667064,
  01273545704,
  0127354570438,
  012735457043849,
  01273545704384962,
  0127354570438496270,
  1273545743849627,
  127354574384962777,
  12735457438496277791,
  273545743849627779, ...
The sequence itself is obtained by replacing the leading zeros by minus signs.
For example, after the term 601273654656670, we first append its digit-sum 64, getting 60127365465667064. Since the leading digit 6 is present in 64, we cancel all the 6's, getting 01273545704. The corresponding term in the sequence is -1273545704.
		

Crossrefs

Programs

  • Mathematica
    a[1] = {1, 1}; nn = 28;
    Do[Which[ListQ[m], k = m; Clear[m],
          FreeQ[#3, #2], Set[k, #1~Join~#3],
          True, Set[k, #1~Join~#3];
          Set[m, DeleteCases[#1~Join~#3, #2]]] & @@
           {#, First[#], IntegerDigits@ Total[#]} &[a[n - 1]];
     Set[a[n], k], {n, 2, nn}];
    Array[(1 - 2 Boole[First[#] == 0])*FromDigits@ # &@ a[#] &, nn] (* Michael De Vlieger, Mar 16 2023 *)

Extensions

More than the usual number of terms are shown in order to clarify the differences from A359143.

A361501 A variant of A359143 in which all copies of a digit d are erased only when d is both the leading digit and the final digit of (a(n) concatenated with sum of digits of a(n)).

Original entry on oeis.org

11, 112, 1124, 11248, 1124816, 112481623, 11248162328, 1124816232838, 112481623283849, 11248162328384962, 1124816232838496270, 112481623283849627077, 2486232838496270779, 248623283849627077997, 248623283849627077997113, 248623283849627077997113118, 248623283849627077997113118128
Offset: 0

Views

Author

N. J. A. Sloane, Mar 17 2023

Keywords

Comments

Since we cannot list nonzero numbers with leading digit 0, we use a minus sign to represent a leading zero.
To compute a(n+1), let m denote the decimal string formed from a(n) by replacing a minus sign (if present) by a leading 0.
Let k denote the concatenation of m and its digit-sum.
If the first and last digits of k are equal, delete all copies of that digit from k.
If k has any leading zeros, replace them with a minus sign. The result is a(n+1).
A359143 eventually reaches 0, but we do not know if the present sequence will reach 0, enter a loop, or grow without limit towards +infinity or -infinity.
From Michael De Vlieger, Mar 17 2023: (Start)
First negative term is a(146).
Sequence continues beyond 2^30 terms. (End)
From Michael S. Branicky, Mar 21 2023: (Start)
The sequence enters a loop of period L = 224339586.
Specifically, a(35179968) = a(259519554) = 8863336630330333333663833080638368062852636350393323037363535737238.
In this loop, the term with the fewest digits is a(101772740) = 48623, and the term with the most digits is a(251014293), with 940 digits. (End)

Examples

			a(11) = 112481623283849627077, which has digit-sum 91.
So k = 11248162328384962707791 both begins and ends with 1.
Erasing all the 1's from k gives a(12) = 2486232838496270779.
		

Crossrefs

Programs

  • Mathematica
    a[1] = {1, 1}; nn = 17;
    Do[If[And[#2 == Last[#3], n > 2],
           Set[k, DeleteCases[#1~Join~#3, #2]],
           Set[k, #1~Join~#3]] & @@
           {#, First[#], IntegerDigits@ Total[#]} &[a[n - 1]];
      Set[a[n], k], {n, 2, nn}];
    Array[(1 - 2 Boole[First[#] == 0])*FromDigits[#] &@ a[#] &, nn] (* Michael De Vlieger, Mar 17 2023 *)

A359142 Let s = sum of digits of n, let t = decimal concatenation of n and s, let u be obtained by deleting all copies of the leading digit of t from t, if this digit occurs in s. Then if u has only zero digits, a(n) = 0; if u has leading digit 0 but not all its digits are 0, delete all leading 0's from u and negate the result to get a(n); otherwise a(n) = u.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 123, 134, 145, 156, 167, 178, 189, 90, 0, 213, 224, 235, 246, 257, 268, 279, 2810, 2911, 0, 314, 325, 336, 347, 358, 369, 3710, 3811, 3912, 0, 415, 426, 437, 448, 459, 4610, 4711, 4812, 4913, 0, 516, 527, 538, 549, 5510, 5611, 5712, 5813
Offset: 1

Views

Author

N. J. A. Sloane, Jan 31 2023, based on suggestions from Eric Angelini and Hans Havermann

Keywords

Comments

Since nonzero numbers may not have leading zeros, we indicate their presence by negating the number.
For use in A359142, we also define a(n) for improper decimal numbers n with leading zeros by following exactly the same steps. To get a(073), for example, we append the digit sum 10, and delete the 0's from 07310, getting a(073) = 731. To get a(074), we append 11, getting 07411, so a(074) = -7411.
The sequence of n such that a(n) < 0 begins (109, 1009, 1018, 1019, 1027, 1028, 1029, 1036, ...): see A359144. - M. F. Hasler, Feb 01 2023

Examples

			Examples:
  n.....s......t....u.....a(n)
  1.....1.....11....0......0
  2.....2.....22....0......0
  .....
  9.....9.....99....0......0
  10....1....101....0......0
  11....2....112..112....112
  12....3....123..123....123
  .....
  100...1...1001...00......0
  101...2...1012.1012...1012
  102...3...1023.1023...1023
  .....
  109..10..10910..090....-90
  .....
		

Crossrefs

Cf. A359143, A359144 (k such that a(k)<0).

Programs

  • Mathematica
    A359142[n_]:= Module[{d=IntegerDigits[n],s,u},If[MemberQ[s=IntegerDigits[Total[d]],First[u=Join[d,s]]],u=DeleteCases[u,First[u]]];If[u=={}||First[u]==0,-1,1]FromDigits[u]];Array[A359142,100] (* Paolo Xausa, Oct 11 2023 *)
  • PARI
    A359142(n) = { my(d=digits(n), s=digits(vecsum(d))); n>0 || d=concat(0,d); n=concat(d, s); setsearch(Set(s), d[1]) && n=select(c->c!=d[1], n); if(n && !n[1], -fromdigits(n), fromdigits(n)) }
    apply(A359142, [0..99]) \\ M. F. Hasler, Feb 01 2023
    
  • Python
    def a(n):
        n = str(-n) if isinstance(n, int) and n < 0 else str(n)
        s = str(sum(map(int, n)))
        t = n + s
        u = t.replace(t[0], "") if t[0] in s else t
        return 0 if u == "" else (-int(u) if u[0] == "0" else int(u))
    print([a(n) for n in range(1, 59)]) # Michael S. Branicky, Feb 01 2023

Extensions

More terms from M. F. Hasler, Feb 01 2023

A372074 a(1) = 1; thereafter a(n+1) is obtained by appending the digit-sum of a(n) to a(n).

Original entry on oeis.org

1, 11, 112, 1124, 11248, 1124816, 112481623, 11248162328, 1124816232838, 112481623283849, 11248162328384962, 1124816232838496270, 112481623283849627077, 11248162328384962707791, 11248162328384962707791101, 11248162328384962707791101103, 11248162328384962707791101103107, 11248162328384962707791101103107115
Offset: 1

Views

Author

N. J. A. Sloane, Jun 16 2024

Keywords

Crossrefs

Cf. A372075.
Inspired by A359143.

Programs

  • Maple
    s:=1; j1:=[s];
    f:=proc(n) local t1,t2;
    t1:=digsum(n);
    t2:=length(t1); n*10^t2 + t1; end;
    for n from 1 to 24 do s:=f(s); j1:=[op(j1),s]; od:
    j1;
  • Mathematica
    NestList[With[{s = DigitSum[#]}, #*10^IntegerLength[s] + s] &, 1, 20] (* Paolo Xausa, Jun 16 2024 *)
  • Python
    from itertools import islice
    def A372074_gen(): # generator of terms
        yield (a:=1)
        while True: yield (a:=(s:=sum(map(int,str(a))))+a*10**len(str(s)))
    A372074_list = list(islice(A372074_gen(),20)) # Chai Wah Wu, Jun 16 2024
Showing 1-4 of 4 results.