login
Numbers k such that k^2 is not divisible by any of its nonzero digits.
4

%I #16 Jul 17 2021 02:50:25

%S 7,17,23,26,47,53,67,73,76,77,83,86,94,97,143,157,163,167,173,176,187,

%T 193,194,197,223,233,236,244,253,256,257,260,274,277,283,287,293,307,

%U 313,314,457,473,493,503,517,523,527,533,547,553,577,583,587,607,613

%N Numbers k such that k^2 is not divisible by any of its nonzero digits.

%H Colin Barker, <a href="/A239210/b239210.txt">Table of n, a(n) for n = 1..1000</a>

%e 53 is a term because 53^2 = 2809 is not divisible by 2, 8 or 9.

%t ndnzQ[n_]:=Count[n^2/Select[IntegerDigits[n^2],#!=0&],_?IntegerQ]==0; Select[Range[750],ndnzQ] (* _Harvey P. Dale_, Jun 02 2015 *)

%o (PARI) isOK(n) = my(v=vecsort(digits(n^2), , 8)); for(i=1+(v[1]==0), #v, if(n^2%v[i]==0, return(0))); 1

%o s=[]; for(n=1, 1000, if(isOK(n), s=concat(s, n))); s

%o (Python)

%o def ok(n): return not any(n*n%int(d) == 0 for d in str(n*n) if d != '0')

%o print(list(filter(ok, range(1, 614)))) # _Michael S. Branicky_, Jul 17 2021

%Y Cf. A239211, A239212, A239213.

%K nonn,base

%O 1,1

%A _Colin Barker_, Mar 12 2014