login
A028843
Numbers whose iterated product of digits is a prime.
9
2, 3, 5, 7, 12, 13, 15, 17, 21, 26, 31, 34, 35, 37, 43, 51, 53, 57, 62, 71, 73, 75, 112, 113, 115, 117, 121, 126, 131, 134, 135, 137, 143, 151, 153, 157, 162, 171, 173, 175, 211, 216, 223, 232, 261, 278, 279, 287, 297, 299, 311, 314, 315, 317, 322, 341, 351, 355
OFFSET
1,1
LINKS
EXAMPLE
For 53, the product of digits is 5 * 3 = 15, iterated to 1 * 5 = 5, which is a prime, so 53 is in the sequence.
For 54, the product of digits is 5 * 4 = 20, iterated to 2 * 0 = 0, which is not prime, so 54 is not in the sequence.
MATHEMATICA
iterDigitProd[n_] := NestWhile[Times@@IntegerDigits[#] &, n, # > 9 &]; Select[Range[355], PrimeQ[iterDigitProd[#]] &] (* Jayanta Basu, Jun 02 2013 *)
PROG
(Scala) def iterDigitProd(n: Int): Int = n.toString.length match {
case 1 => n
case _ => iterDigitProd(n.toString.toCharArray.map(_ - 48).scanRight(1)(_ * _).head)
}
(1 to 400).filter(n => List(2, 3, 5, 7).contains(iterDigitProd(n))) // Alonso del Arte, Apr 11 2020
CROSSREFS
KEYWORD
nonn,base
EXTENSIONS
More terms from Patrick De Geest, Jun 15 1999
Corrected by Franklin T. Adams-Watters, Jan 17 2007
STATUS
approved