A145389 Digital roots of triangular numbers.
0, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6, 3, 1, 9, 9, 1, 3, 6, 1, 6
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,0,0,1).
Programs
-
Mathematica
digitalRoot[n_Integer?Positive] := FixedPoint[Plus@@IntegerDigits[#]&,n]; Table[If[n==0,0,digitalRoot[n(n+1)/2]], {n,0,100}] (* Vladimir Joseph Stephan Orlovsky, May 02 2011 *)
-
PARI
a(n)=if(n, n=n*(n+1)/2%9; if(n, n, 9), 0) \\ Charles R Greathouse IV, Dec 19 2016
-
Python
def A145389(n): return (9, 1, 3, 6, 1, 6, 3, 1, 9)[n%9] if n else 0 # Chai Wah Wu, Feb 09 2023
Comments