A067109 Number of occurrences of the string n in n! (A000142).
1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 2, 0, 2, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 1, 0, 2, 1, 1, 0, 0, 2, 0, 0, 1, 0, 0, 2, 2, 4, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 2, 1, 2, 5, 0
Offset: 1
Examples
a(4) = 1 as 4! = 24 and 4 occurs once; a(5) = 0 as 5! = 120 does not contain a 5; a(20) = 1 as 20! = 2432902008176640000 and 20 occurs once.
Links
- T. D. Noe, Table of n, a(n) for n=1..1000
Programs
-
Haskell
import Data.List (tails, isPrefixOf) a067109 n = sum $ map (fromEnum . (show n `isPrefixOf`)) (tails $ show $ a000142 n) -- Reinhard Zumkeller, Aug 28 2014
-
Mathematica
Table[ Length[ StringPosition[ ToString[n! ], ToString[n]]], {n, 1, 75} ] Table[SequenceCount[IntegerDigits[n!],IntegerDigits[n],Overlaps->True],{n,100}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 01 2019 *)
Extensions
More terms from Robert G. Wilson v, Jan 09 2002
Comments