login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A247796 From right to left in decimal representation of n: replace each maximal set of adjacent digits with their sum, if this sum is less than 10. 3
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19, 2, 3, 4, 5, 6, 7, 8, 9, 28, 29, 3, 4, 5, 6, 7, 8, 9, 37, 38, 39, 4, 5, 6, 7, 8, 9, 46, 47, 48, 49, 5, 6, 7, 8, 9, 55, 56, 57, 58, 59, 6, 7, 8, 9, 64, 65, 66, 67, 68, 69, 7, 8, 9, 73, 74, 75, 76, 77 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
a(n) <= n; a(A248013(n)) = A248013(n); a(A248014(n)) < A248014(n);
a(n) = a(a(n)) = a(A004719(n)) = a(n * 10^k).
EXAMPLE
7654321: 7654[321] -> 7654[3+2+1] -> 76546 -> 76[54]6 -> 76[5+4]6 -> 7696 = a(7654321);
1234567: 123[45]67 -> 123[4+5]67 -> 123967 -> [123]967 -> [1+2+3]967 -> 6967 = a(1234567);
1111111: [1111111] -> [1+1+1+1+1+1+1] -> 7 = a(1111111);
a(7777777) = 7777777;
90909: 909[09] -> 909[0+9] -> 9099 -> 9[09]9 -> 9[0+9]9 -> 999 = a(90909);
20202: [20202] -> [2+0+2+0+2] -> 6 = a(20202).
PROG
(Haskell)
a247796 = f 0 where
f s 0 = s
f s x = if s + d < 10 then f (s + d) x' else (f d x') * 10 + s
where (x', d) = divMod x 10
(PARI) A247796(n, d=digits(n))={forstep(k=#d, 2, -1, if(d[k-1]+d[k]<10, d[k-1]+=d[k]; d=d[^k])); fromdigits(d)} /* or: (about 10% faster) */
A247796(n, u=1)={until(n<10*u*=10, my(m=n\u); while(m>9&&sumdigits(m%100)<10, m=vecsum(divrem(m, 10)); n=m*u+n%u)); n} \\ Trying to reduce the number of redefinitions of n yields slower code. M. F. Hasler, Jan 29 2018
CROSSREFS
Sequence in context: A114570 A349194 A342829 * A355370 A326344 A340270
KEYWORD
nonn,base,look
AUTHOR
Reinhard Zumkeller, Oct 08 2014
EXTENSIONS
Edited by M. F. Hasler, Jan 29 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 7 09:38 EDT 2024. Contains 372302 sequences. (Running on oeis4.)