login
Numbers whose largest digit of all divisors is 2.
3

%I #33 Aug 03 2022 10:48:34

%S 2,22,121,202,211,1021,1201,2011,2111,2221,2222,10201,10211,12011,

%T 12101,12211,12221,20011,20021,20101,20201,20222,21001,21011,21101,

%U 21121,21211,21221,22111,22121,101021,101221,102001,102101,102121,110221,111121,111211,111221,112111,112121

%N Numbers whose largest digit of all divisors is 2.

%C Also numbers k such that the largest digit of the concatenation of all the divisors (A037278) of k is 2.

%C Numbers k such that A209928(k) = 2.

%C Union of A221698 and A106100.

%H Michael S. Branicky, <a href="/A221697/b221697.txt">Table of n, a(n) for n = 1..10000</a>

%e 10201 is a term because the largest digit of all the divisors of 10201 (1, 101, 10201) is 2.

%p isA221697 := proc(n)

%p local dgs,d;

%p dgs := {} ;

%p for d in numtheory[divisors](n) do

%p dgs := dgs union convert(convert(d,base,10),set) ;

%p end do:

%p if max(op(dgs)) = 2 then

%p true;

%p else

%p false;

%p end if;

%p end proc:

%p for n from 2 to 112121 do

%p if isA221697(n) then

%p printf("%d,",n) ;

%p end if;

%p end do: # _R. J. Mathar_, Jan 30 2013

%t Select[Range[115000],Max[Flatten[IntegerDigits/@Divisors[#]]]==2&] (* _Harvey P. Dale_, Dec 15 2014 *)

%o (Python)

%o from sympy import divisors

%o def ok(n): return '2' == max("".join(map(str, divisors(n))))

%o print([m for m in range(1, 112122) if ok(m)]) # _Michael S. Branicky_, Feb 22 2021

%o (Python)

%o from sympy import isprime, divisors

%o from itertools import count, islice, product

%o def agen(): # generator of terms

%o yield 2

%o for d in count(2):

%o for f in "12":

%o for mid in product("012", repeat=d-2):

%o for e in "12": # ending in zero has 5 as divisor

%o s = f+"".join(mid)+e

%o t = int(s)

%o if "2" in s and isprime(t): yield t; continue

%o if "2" == max("".join(map(str, divisors(t)))): yield t

%o print(list(islice(agen(), 50))) # _Michael S. Branicky_, Aug 03 2022

%Y Cf. A037278, A106100, A209928 (largest digit of all divisors of n), A221698.

%K nonn,base

%O 1,1

%A _Jaroslav Krizek_, Jan 22 2013, corrected Jan 29 2013