%I #27 Oct 15 2021 20:03:35
%S 0,1,2,3,4,5,6,7,8,9,22,48,84,109,123,132,137,145,154,159,173,178,187,
%T 190,195,208,213,228,231,233,235,237,239,248,253,268,273,280,282,284,
%U 286,288,293,307,312,317,321,323,325,327,329,332,337,347,352,357,367,370,371,372,373,374,375,376,377
%N Nonnegative integers such that the sum of digits mod 10 equals the product of digits mod 10.
%H David A. Corneth, <a href="/A232709/b232709.txt">Table of n, a(n) for n = 1..10000</a>
%e 293 is in the sequence because 2+9+3 = 14 == 4 mod 10 and 2*9*3 = 54 == 4 mod 10.
%t Select[Range[0,400],Mod[Total[IntegerDigits[#]],10]==Mod[Times@@ IntegerDigits[ #],10]&] (* _Harvey P. Dale_, Oct 15 2021 *)
%o (JavaScript)
%o for (i=0;i<1000;i++) {
%o s=i.toString().split("");
%o sl=s.length;
%o c=0;d=1;
%o for (j=0;j<sl;j++) {c+=s[j]*1;d*=s[j];}
%o c%=10;d%=10;
%o if (c==d) document.write(i+", ");
%o }
%o (PARI) is(n) = my(d=digits(n));vecsum(d)%10==vecprod(d)%10 \\ _David A. Corneth_, Oct 15 2021
%o (Python)
%o from math import prod
%o def ok(n): d = list(map(int, str(n))); return sum(d)%10 == prod(d)%10
%o print([k for k in range(378) if ok(k)]) # _Michael S. Branicky_, Oct 15 2021
%Y Cf. A034710.
%K nonn,base
%O 1,3
%A _Jon Perry_, Nov 28 2013
%E Offset changed from 0 to 1 by _N. J. A. Sloane_, Oct 15 2021
|