a = 4;
primes = Prime[Range[PrimePi[10^(a - 1)] + 1, PrimePi[10^a]]];
d = 1;
Cases[IntegerDigits[primes], {_, d .., _}]
This gets me the list of the numbers from my list of primes that have more than one 1 in a row.
{{1, 1, 1, 7}, {2, 1, 1, 1}, {2, 1, 1, 3}, {3, 1, 1, 9}, {4, 1, 1, 1},
{5, 1, 1, 3}, {5, 1, 1, 9}, {6, 1, 1, 3}, {8, 1, 1, 1}, {8, 1, 1, 7}}
Is there a way to get the length of the repeating digits? For instance, I'd rather get an output of
{3,3,2,2,3,2,2,2,3,2}
My goal is to get the count of the ones with the maximum length.
Cases[IntegerDigits[primes], id : {_, d .., _} :> Count[id, 1]]
? $\endgroup$