OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
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
AUTHOR
EXTENSIONS
More terms from Patrick De Geest, Jun 15 1999
Corrected by Franklin T. Adams-Watters, Jan 17 2007
STATUS
approved