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.

A052423 Highest common factor of nonzero digits of n.

This page as a plain text file.
%I A052423 #18 Apr 04 2020 16:44:03
%S A052423 1,2,3,4,5,6,7,8,9,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,3,1,1,3,1,
%T A052423 1,3,1,1,3,4,1,2,1,4,1,2,1,4,1,5,1,1,1,1,5,1,1,1,1,6,1,2,3,2,1,6,1,2,
%U A052423 3,7,1,1,1,1,1,1,7,1,1,8,1,2,1,4,1,2,1,8,1,9,1,1,3,1,1,3,1,1,9,1,1,1
%N A052423 Highest common factor of nonzero digits of n.
%H A052423 Reinhard Zumkeller, <a href="/A052423/b052423.txt">Table of n, a(n) for n = 1..10000</a>
%F A052423 a(A069715(n)) = 1. - _Reinhard Zumkeller_, Apr 14 2014
%e A052423 a(46) = 2 because the highest common factor of 4 and 6 is 2.
%e A052423 a(47) = 1 because the highest common factor of 4 and 7 is 1.
%p A052423 a:= n-> igcd(subs(0=[][], convert(n, base, 10))[]):
%p A052423 seq(a(n), n=1..100);  # _Alois P. Heinz_, Apr 04 2020
%t A052423 Table[Apply[GCD, IntegerDigits[n]], {n, 100}] (* _Alonso del Arte_, Apr 02 2020 *)
%o A052423 (Haskell)
%o A052423 a052423 n = f n n where
%o A052423    f x 1 = 1
%o A052423    f x y | x < 10    = gcd x y
%o A052423          | otherwise = if d == 1 then 1 else f x' (gcd d y)
%o A052423          where (x', d) = divMod x 10
%o A052423 -- _Reinhard Zumkeller_, Apr 14 2014
%o A052423 (Scala) def euclGCD(a: Int, b: Int): Int = b match { case 0 => a; case n => Math.abs(euclGCD(b, a % b)) }
%o A052423 def digitGCD(n: Int) = n.toString.toCharArray.map(_ - 48).scanLeft(0)(euclGCD(_, _)).last
%o A052423 (1 to 100).map(digitGCD(_)) // _Alonso del Arte_, Apr 02 2020
%o A052423 (PARI) a(n) = my(d=digits(n)); gcd(select(x->(x!=0), d)); \\ _Michel Marcus_, Apr 04 2020
%Y A052423 Cf. A007954.
%K A052423 base,easy,nonn
%O A052423 1,2
%A A052423 _Henry Bottomley_, Mar 17 2000