OFFSET
1,6
COMMENTS
For the operation of taking the sequence of run-lengths of a finite sequence, runs-resistance is defined as the number of applications required to reach a singleton.
A prime index of n is a number m such that prime(m) divides n. The sequence of prime indices of n is row n of A112798.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
Claude Lenormand, Deux transformations sur les mots, Preprint, 5 pages, Nov 17 2003.
EXAMPLE
We have (1,2,2,3) -> (1,2,1) -> (1,1,1) -> (3), so a(90) = 3.
MATHEMATICA
primeMS[n_]:=If[n==1, {}, Flatten[Cases[FactorInteger[n], {p_, k_}:>Table[PrimePi[p], {k}]]]];
runsres[q_]:=Length[NestWhileList[Length/@Split[#]&, q, Length[#]>1&]]-1;
Table[runsres[primeMS[n]], {n, 50}]
PROG
(PARI)
pis_to_runs(n) = { my(runs=List([]), f=factor(n)); for(i=1, #f~, while(f[i, 2], listput(runs, primepi(f[i, 1])); f[i, 2]--)); (runs); };
runlengths(lista) = if(!#lista, lista, if(1==#lista, List([1]), my(runs=List([]), rl=1); for(i=1, #lista, if((i< #lista) && (lista[i]==lista[i+1]), rl++, listput(runs, rl); rl=1)); (runs)));
A329747(n) = { my(runs=pis_to_runs(n)); for(i=0, oo, if(#runs<=1, return(i), runs = runlengths(runs))); }; \\ Antti Karttunen, Jan 20 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Nov 21 2019
EXTENSIONS
More terms from Antti Karttunen, Jan 20 2025
STATUS
approved