login
Greatest common divisor of a number and its last decimal digit: a(n) = gcd(n, n mod 10).
2

%I #11 Aug 02 2019 03:45:33

%S 0,1,2,3,4,5,6,7,8,9,10,1,2,1,2,5,2,1,2,1,20,1,2,1,4,5,2,1,4,1,30,1,2,

%T 3,2,5,6,1,2,3,40,1,2,1,4,5,2,1,8,1,50,1,2,1,2,5,2,1,2,1,60,1,2,3,4,5,

%U 6,1,4,3,70,1,2,1,2,5,2,7,2,1,80,1,2,1,4,5

%N Greatest common divisor of a number and its last decimal digit: a(n) = gcd(n, n mod 10).

%e a(69) = gcd(69,9) = 3.

%t Table[GCD[n, Mod[n, 10]], {n, 0, 100}] (* _T. D. Noe_, Jul 24 2012 *)

%o (Java)

%o import java.math.BigInteger;

%o public class A214587 {

%o public static void main (String[] args) {

%o for (long n=0; n<222; n++) {

%o BigInteger bn=BigInteger.valueOf(n), ld=BigInteger.valueOf(n%10);

%o System.out.printf("%s, ", bn.gcd(ld).toString());

%o }

%o }

%o }

%Y Cf. A068822.

%K nonn,base

%O 0,3

%A _Alex Ratushnyak_, Jul 22 2012