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.
%I A010888 #138 Feb 16 2025 08:32:32 %S A010888 0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6, %T A010888 7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4, %U A010888 5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5 %N A010888 Digital root of n (repeatedly add the digits of n until a single digit is reached). %C A010888 This is sometimes also called the additive digital root of n. %C A010888 n mod 9 (A010878) is a very similar sequence. %C A010888 Partial sums are given by A130487(n-1) + n (for n > 0). - _Hieronymus Fischer_, Jun 08 2007 %C A010888 Decimal expansion of 13717421/111111111 is 0.123456789123456789123456789... with period 9. - _Eric Desbiaux_, May 19 2008 %C A010888 Decimal expansion of 13717421 / 1111111110 = 0.0[123456789] (periodic) - _Daniel Forgues_, Feb 27 2017 %C A010888 a(A005117(n)) < 9. - _Reinhard Zumkeller_, Mar 30 2010 %C A010888 My friend Jahangeer Kholdi has found that 19 is the smallest prime p such that for each number n, a(p*n) = a(n). In fact we have: a(m*n) = a(a(m)*a(n)) so all numbers with digital root 1 (numbers of the form 9k + 1) have this property. See comment lines of A017173. Also we have a(m+n) = a(a(m) + a(n)). - _Farideh Firoozbakht_, Jul 23 2010 %D A010888 Martin Gardner, Mathematics, Magic and Mystery, 1956. %H A010888 N. J. A. Sloane, <a href="/A010888/b010888.txt">Table of n, a(n) for n = 0..10000</a> %H A010888 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Digitaddition.html">Digitaddition</a> %H A010888 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/DigitalRoot.html">Digital Root</a> %H A010888 Wikipedia, <a href="http://en.wikipedia.org/wiki/Vedic_square">Vedic square</a> %H A010888 <a href="/index/Coi#Colombian">Index entries for Colombian or self numbers and related sequences</a> %H A010888 <a href="/index/Rec#order_09">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,0,0,0,1). %F A010888 If n = 0 then a(n) = 0; otherwise a(n) = (n reduced mod 9), but if the answer is 0 change it to 9. %F A010888 Equivalently, if n = 0 then a(n) = 0, otherwise a(n) = (n - 1 reduced mod 9) + 1. %F A010888 If the initial 0 term is ignored, the sequence is periodic with period 9. %F A010888 From _Hieronymus Fischer_, Jun 08 2007: (Start) %F A010888 a(n) = A010878(n-1) + 1 (for n > 0). %F A010888 G.f.: g(x) = x*(Sum_{k = 0..8}(k+1)*x^k)/(1 - x^9). Also: g(x) = x(9x^10 - 10x^9 + 1)/((1 - x^9)(1 - x)^2). (End) %F A010888 a(n) = n - 9*floor((n-1)/9), for n > 0. - _José de Jesús Camacho Medina_, Nov 10 2014 %e A010888 The digits of 37 are 3 and 7, and 3 + 7 = 10. And the digits of 10 are 1 and 0, and 1 + 0 = 1, so a(37) = 1. %p A010888 A010888 := n->if n=0 then 0 else ((n-1) mod 9) + 1; fi; # _N. J. A. Sloane_, Feb 20 2013 %t A010888 Join[{0}, Array[Mod[ # - 1, 9] + 1 &, 104]] (* _Robert G. Wilson v_, Jan 04 2006 *) %t A010888 Join[Range[0, 1], Table[n - 9 Floor[(n - 1) / 9], {n, 2, 100}]] (* _José de Jesús Camacho Medina_, Nov 10 2014 *) (* Corrected by _Vincenzo Librandi_, Nov 11 2014 *) %t A010888 Join[{0},LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 1},{1, 2, 3, 4, 5, 6, 7, 8, 9},104]] (* _Ray Chandler_, Aug 26 2015 *) %t A010888 Table[FixedPoint[Total[IntegerDigits[#, 10]] &, n], {n, 0, 104}] (* _IWABUCHI Yu(u)ki_, Jun 03 2016 *) %o A010888 (PARI) A010888(n)=if(n,(n-1)%9+1) \\ _M. F. Hasler_, Jan 04 2011 %o A010888 (Haskell) %o A010888 a010888 = until (< 10) a007953 %o A010888 -- _Reinhard Zumkeller_, Oct 17 2011, May 12 2011 %o A010888 (Python) %o A010888 def A010888(n): %o A010888 return 1 + (n - 1) % 9 if n else 0 # _Chai Wah Wu_, Aug 23 2014, Apr 23 2023 %o A010888 (Magma) [n eq 0 select 0 else 1+(n-1) mod 9: n in [0..110]]; // _Bruno Berselli_, Mar 18 2016 %o A010888 (Scala) 0 :: List.fill(10)(1 to 9).flatten // _Alonso del Arte_, Feb 01 2020 %Y A010888 Cf. A007953, A007954, A031347, A113217, A113218, A010878 (n mod 9), A010872, A010873, A010874, A010875, A010876, A010877, A010879, A004526, A002264, A002265, A002266, A017173, A031286 (additive persistence of n), (multiplicative digital root of n), A031346 (multiplicative persistence of n). %K A010888 nonn,easy,nice,base %O A010888 0,3 %A A010888 _N. J. A. Sloane_