login
Digital roots of triangular numbers.
8

%I #44 Dec 12 2023 08:24:32

%S 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,

%T 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,

%U 6,3,1,9,9,1,3,6,1,6,3,1,9,9,1,3,6,1,6

%N Digital roots of triangular numbers.

%C Decimal expansion of 45387733/3333333330. - _Enrique PĂ©rez Herrero_, Nov 14 2021

%H <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 a(n) = A010888(A000217(n)).

%F Periodic sequence for n>0: a(n+9) = a(n);

%F a(A016777(n)) = 1; a(A007494(n)) <> 1;

%F a(A090570(n)) = A010888(A090570(n)).

%F a(n) = 1 + ((n^2 + n - 2)/2) mod 9. - _Ant King_, Apr 25 2009

%F G.f.: x(1 + 3x + 6x^2 + x^3 + 6x^4 + 3x^5 + x^6 + 9x^7 + 9x^8)/((1-x)(1 + x + x^2)(1 + x^3 + x^6)). - _Ant King_, Nov 16 2010

%t 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 *)

%o (PARI) a(n)=if(n, n=n*(n+1)/2%9; if(n, n, 9), 0) \\ _Charles R Greathouse IV_, Dec 19 2016

%o (Python)

%o 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

%Y Cf. A000217, A004157, A010888.

%K nonn,base,easy

%O 0,3

%A _Reinhard Zumkeller_, Oct 10 2008