Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #16 Nov 12 2024 03:07:00
%S 1,0,1,2,3,4,5,6,7,8,2,1,0,1,2,3,4,5,6,7,3,2,1,0,1,2,3,4,5,6,4,3,2,1,
%T 0,1,2,3,4,5,5,4,3,2,1,0,1,2,3,4,6,5,4,3,2,1,0,1,2,3,7,6,5,4,3,2,1,0,
%U 1,2,8,7,6,5,4,3,2,1,0,1,9,8,7,6,5,4,3,2,1,0,1,0,1,2,3,4,5,6,7,8,1
%N Apply the map k -> A040115(k) repeatedly to n until a single digit is reached.
%C Leading zeros at any intermediate result are discarded. The first terms, from n=10 to n=99, are identical to A040115. - _R. J. Mathar_, Aug 28 2007
%H T. D. Noe, <a href="/A113608/b113608.txt">Table of n, a(n) for n=10..10000</a>
%e a(1396) = 1 because A040115(1396) = 263, A040115(263) = 43, A040115(43) = 1.
%e a(1237584965) = 1 from 6-fold application of A040115: 1237584965 -> 114234531 -> 3211122 -> 110010 -> 01011 = 1011 -> 110 -> 01 -> 1.
%p A040115 := proc(n) local digs,digsdiff,i; digsdiff := [] ; digs := convert(n,base,10) ; for i from 2 to nops(digs) do digsdiff := [op(digsdiff),abs(op(i,digs)-op(i-1,digs))] ; od; add( op(i,digsdiff)*10^(i-1),i=1..nops(digsdiff)) ; end:
%p A113608 := proc(n) local a; a := A040115(n) ; while a>9 do a := A040115(a) ; od; RETURN(a) ; end: seq(A113608(n),n=10..110) ; # _R. J. Mathar_, Aug 28 2007
%t a[n_] := NestWhile[FromDigits[Abs[Differences[IntegerDigits[#]]]] &, n, # > 9 &]; Array[a, 120, 10] (* _Amiram Eldar_, Nov 12 2024 *)
%Y Cf. A040115.
%K base,easy,nonn
%O 10,4
%A _Amarnath Murthy_, Nov 09 2005
%E Edited and extended by _R. J. Mathar_, Aug 28 2007
%E Further edited by _N. J. A. Sloane_, Aug 19 2008