cp's OEIS Frontend

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.

A109012 a(n) = gcd(n,9).

This page as a plain text file.
%I A109012 #41 Aug 28 2024 04:15:28
%S A109012 9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,
%T A109012 1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,
%U A109012 1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1,1,3,1,1,3,1,1,9,1
%N A109012 a(n) = gcd(n,9).
%C A109012 Start with positive integer n. At each step, either (a) multiply by any positive integer or (b) remove all zeros from the number. a(n) is the smallest number that can be reached by this process. - _David W. Wilson_, Nov 01 2005
%C A109012 From _Martin Fuller_, Jul 09 2007: (Start)
%C A109012 Also the minimal positive difference between numbers whose digit sum is a multiple of n. Proof:
%C A109012 Construction: Pick a positive number that does not end with 9, and has a digit sum n-a(n). To form the lower number, append 9 until the digit sum is a multiple of n. This is always possible since the difference is gcd(n,9). Add a(n) to form the higher number, which will have digit sum n.
%C A109012 E.g., n=12: prefix=18, lower=18999, higher=19002, difference=3.
%C A109012 Minimality: All numbers are a multiple of a(n) if their digit sum is a multiple of n. Hence the minimal difference is at least a(n). (End)
%H A109012 Antti Karttunen, <a href="/A109012/b109012.txt">Table of n, a(n) for n = 0..100000</a>
%H A109012 <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 A109012 a(n) = 1 + 2*[3|n] + 6*[9|n], where [x|y] = 1 when x divides y, 0 otherwise.
%F A109012 a(n) = a(n-9).
%F A109012 Multiplicative with a(p^e, 9) = gcd(p^e, 9). - _David W. Wilson_, Jun 12 2005
%F A109012 G.f.: (-9 - x - x^2 - 3*x^3 - x^4 - x^5 - 3*x^6 - x^7 - x^8) / ((x-1)*(1 + x + x^2)*(x^6 + x^3 + 1)). - _R. J. Mathar_, Apr 04 2011
%F A109012 Dirichlet g.f.: (1+2/3^s+6/9^s)*zeta(s). - _R. J. Mathar_, Apr 04 2011
%t A109012 GCD[Range[0, 100], 9] (* _Paolo Xausa_, Aug 28 2024 *)
%o A109012 (PARI) a(n)=gcd(n,9) \\ _Charles R Greathouse IV_, Oct 07 2015
%o A109012 (Python)
%o A109012 from math import gcd
%o A109012 def a(n): return gcd(n, 9)
%o A109012 print([a(n) for n in range(101)]) # _Michael S. Branicky_, Sep 01 2021
%Y A109012 Cf. A109004.
%Y A109012 Cf. A109007, A109008, A109009, A109010, A109011, A109013, A109014, A109015.
%Y A109012 Cf. A074232, A374039.
%K A109012 nonn,easy,mult
%O A109012 0,1
%A A109012 _Mitch Harris_