%I #59 Feb 19 2024 10:28:21
%S 1,8,10,17,19,26,28,35,37,44,46,53,55,62,64,71,73,80,82,89,91,98,100,
%T 107,109,116,118,125,127,134,136,143,145,152,154,161,163,170,172,179,
%U 181,188,190,197,199,206,208,215,217,224,226,233,235,242,244,251,253
%N Numbers that are congruent to +-1 mod 9.
%C Or, numbers k such that k^2 == 1 (mod 9).
%C Or, numbers k such that the iterative cycle j -> sum of digits of j^2 when started at k contains a 1. E.g., 8 -> 6+4 = 10 -> 1+0+0 = 1 and 17 -> 2+8+9 = 19 -> 3+6+1 = 10 -> 1+0+0 = 1. - _Asher Auel_, May 17 2001
%H Vincenzo Librandi, <a href="/A056020/b056020.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,-1).
%F a(1) = 1; a(n) = 9(n-1) - a(n-1). - _Rolf Pleisch_, Jan 31 2008 [Offset corrected by _Jon E. Schoenfield_, Dec 22 2008]
%F From _R. J. Mathar_, Feb 10 2008: (Start)
%F O.g.f.: 1 + 5/(4(x+1)) + 27/(4(-1+x)) + 9/(2(-1+x)^2).
%F a(n+1) - a(n) = A010697(n). (End)
%F a(n) = (9*A132355(n) + 1)^(1/2). - _Gary Detlefs_, Feb 22 2010
%F From _Bruno Berselli_, Nov 17 2010: (Start)
%F a(n) = a(n-2) + 9, for n > 2.
%F a(n) = 9*A000217(n-1) + 1 - 2*Sum_{i=1..n-1} a(i), n > 1. (End)
%F Sum_{n>=1} (-1)^(n+1)/a(n) = (Pi/9)*cot(Pi/9) = A019676 * A019968. - _Amiram Eldar_, Dec 04 2021
%F E.g.f.: 1 + ((18*x - 9)*exp(x) + 5*exp(-x))/4. - _David Lovler_, Sep 04 2022
%t Select[ Range[ 300 ], PowerMod[ #, 2, 3^2 ]==1& ]
%o (PARI) a(n)=9*(n>>1)+if(n%2,1,-1) \\ _Charles R Greathouse IV_, Jun 29 2011
%o (PARI) for(n=1,40,print1(9*n-8,", ",9*n-1,", ")) \\ _Charles R Greathouse IV_, Jun 29 2011
%o (Haskell)
%o a056020 n = a056020_list !! (n-1)
%o a05602_list = 1 : 8 : map (+ 9) a056020_list
%o -- _Reinhard Zumkeller_, Jan 07 2012
%Y Cf. A007953, A047522 (n=1 or 7 mod 8), A090771 (n=1 or 9 mod 10).
%Y Cf. A129805 (primes), A195042 (partial sums).
%Y Cf. A005408, A019676, A019968, A047209, A007310, A047336, A175885, A091998, A175886, A113801, A175887.
%K nonn,easy
%O 1,2
%A _Robert G. Wilson v_, Jun 08 2000