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.
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
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 .....
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
- Eric Angelini, Does this iteration end? (Sum and erase), Personal blog "Cinquante Signes", blogspot.com, Jul 26 2022.
- Eric Angelini, Does this iteration end? (Sum and erase), Personal blog "Cinquante Signes", blogspot.com, Jul 26 2022. [Cached copy, pdf file, with permission]
- Hans Havermann, Cycles in Eric Angelini's sum-and-erase, Personal blog "Glad Hobo Express", blogspot.com, Jul 28 2022.
- N. J. A. Sloane, New Gilbreath Conjectures, Sum and Erase, Dissecting Polygons, and Other New Sequences, Doron Zeilberger's Exper. Math. Seminar, Rutgers, Sep 14 2023: Video, Slides, Updates. (Mentions this sequence.)
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
Comments