login
Squares which are divisible by the product of their digits.
1

%I #13 Aug 24 2014 10:14:02

%S 1,4,9,36,144,1296,2916,11664,41616,82944,186624,1218816,2214144,

%T 11614464,21123216,21233664,22127616,27123264,49787136,122943744,

%U 146313216,171714816,222129216,429981696,812934144,1316818944

%N Squares which are divisible by the product of their digits.

%C Subsequence of squares in A007602. - _Michel Marcus_, Aug 24 2014

%H Chai Wah Wu, <a href="/A118548/b118548.txt">Table of n, a(n) for n = 1..143</a>

%e 2916 is in the sequence because (1) it is a square, (2) the product of its digits is 2*9*1*6=108 and (3) 2916 is divisible by 108.

%t sdpdQ[n_]:=Module[{idn=IntegerDigits[n]},!MemberQ[idn,0]&&Divisible[ n,Times@@idn]]; Select[Range[40000]^2,sdpdQ] (* _Harvey P. Dale_, Jul 04 2013 *)

%o (Python)

%o from operator import mul

%o from functools import reduce

%o from gmpy2 import t_mod, mpz

%o A118548 = [n for n in (x**2 for x in range(1,10**6)) if not (str(n).count('0') or t_mod(n, reduce(mul,(mpz(d) for d in str(n)))))]

%o # _Chai Wah Wu_, Aug 23 2014

%o (PARI) lista(nn) = {for (n=1, nn, sq = n^2; d = digits(sq); p = prod(k=1, #d, d[k]); if (p && !(sq % p), print1(sq, ", ")););} \\ _Michel Marcus_, Aug 24 2014

%Y Cf. A007602.

%K base,nonn

%O 1,2

%A Luc Stevens (lms022(AT)yahoo.com), May 03 2006