A328620 Number of nonleading zeros in primorial base expansion of n, a(0) = 0 by convention.
0, 0, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 3, 2, 2, 1, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 3, 2, 2, 1, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0, 1, 0, 3, 2, 2, 1, 2, 1, 2, 1, 1, 0, 1, 0, 2, 1, 1, 0
Offset: 0
Links
Crossrefs
Programs
-
Mathematica
a[n_] := Module[{k = n, p = 2, s = 0, r}, While[{k, r} = QuotientRemainder[k, p]; k != 0 || r != 0, If[r == 0, s++]; p = NextPrime[p]]; s]; Array[a, 100, 0] (* Amiram Eldar, Mar 13 2024 *)
-
PARI
A328620(n) = { my(s=0, p=2); while(n, s += (0==(n%p)); n = n\p; p = nextprime(1+p)); (s); };