%I #20 Oct 09 2017 00:04:44
%S 0,0,2,2,3,2,2,4,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,
%T 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
%U 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
%N Multiplicative persistence of the Sierpinski numbers of the first kind (n^n + 1).
%C Question: Are there any terms larger than 1 after a(22) = 2? In other words, do all terms of A014566 contain zero somewhere in their decimal representation after A014566(22) = 341427877364219557396646723585? - _Antti Karttunen_, Oct 08 2017
%H Antti Karttunen, <a href="/A131836/b131836.txt">Table of n, a(n) for n = 1..2048</a>
%F a(n) = A031346(A014566(n)). - _Michel Marcus_, Oct 08 2017
%e For n=4 we have A014566(4) = Sierpinski number 257 --> 2*5*7 = 70 --> 7*0 = 0 thus persistence = 2, and a(4) = 2. - Edited by _Antti Karttunen_, Oct 08 2017
%p P:=proc(n) local i,k,w,ok,cont; for i from 1 by 1 to n do w:=1; k:=i^i+1; ok:=1; if k<10 then print(0); else cont:=1; while ok=1 do while k>0 do w:=w*(k-(trunc(k/10)*10)); k:=trunc(k/10); od; if w<10 then ok:=0; print(cont); else cont:=cont+1; k:=w; w:=1; fi; od; fi; od; end: P(100);
%t Table[-1 + Length@ NestWhileList[Times @@ IntegerDigits@ # &, If[n == 0, 2, n^n + 1], # > 9 &], {n, 105}] (* _Michael De Vlieger_, Oct 08 2017 *)
%o (Scheme)
%o ;; The whole program follows:
%o (define (A131836 n) (A031346 (A014566 n)))
%o (define (A014566 n) (+ 1 (expt n n)))
%o (define (A031346 n) (let loop ((n n) (k 0)) (if (< n 10) k (loop (A007954 n) (+ 1 k)))))
%o (define (A007954 n) (if (zero? n) n (let loop ((n n) (m 1)) (if (zero? n) m (let ((d (modulo n 10))) (loop (/ (- n d) 10) (* d m)))))))
%o ;; _Antti Karttunen_, Oct 08 2017
%Y Cf. A014566, A031346.
%K easy,nonn,base
%O 1,3
%A _Paolo P. Lava_ and _Giorgio Balzarotti_, Jul 20 2007