

A117737


Numbers such that the (positive) difference between the sum of the digits and the product of the digits is a prime number.


1



20, 24, 25, 27, 29, 30, 33, 34, 35, 37, 38, 42, 43, 45, 47, 49, 50, 52, 53, 54, 56, 57, 59, 65, 67, 70, 72, 73, 74, 75, 76, 78, 79, 83, 87, 92, 94, 95, 97, 101, 102, 104, 106, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 125, 126, 128, 131, 133, 140
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


LINKS

Robert Israel, Table of n, a(n) for n = 1..10000


EXAMPLE

97 is in the sequence because the sum of its digits is 16, the product of its digits is 63 and the difference between 16 and 63 is 47, which is a prime.


MAPLE

filter:= proc(n) local L;
L:= convert(n, base, 10);
isprime(abs(convert(L, `+`)convert(L, `*`)))
end proc:
select(filter, [$1..1000]); # Robert Israel, Jan 22 2019


MATHEMATICA

Select[Range[140], PrimeQ[Abs[Plus@@(x=IntegerDigits[#])Times@@x]]&] (* Jayanta Basu, May 18 2013 *)


PROG

(PARI) sudig(i, suOrmul)= { local(nshft, resul) ; nshft = i ; resul = nshft % 10 ; nshft = nshft \ 10 ; while(nshft>0, if(suOrmul==0, resul += nshft % 10, resul *= nshft % 10 ) ; nshft \= 10 ; ) ; return(resul) ; } { for(n=10, 150, summ = sudig(n, 0) ; mull = sudig(n, 1) ; if( isprime(summmull), print1(n, ", ") ) ; ) ; } \\ R. J. Mathar, Apr 21 2006


CROSSREFS

Cf. A000040.
Sequence in context: A199360 A199585 A093716 * A062908 A111323 A250289
Adjacent sequences: A117734 A117735 A117736 * A117738 A117739 A117740


KEYWORD

base,nonn


AUTHOR

Luc Stevens (lms022(AT)yahoo.com), Apr 14 2006


EXTENSIONS

More terms from R. J. Mathar, Apr 21 2006


STATUS

approved



