login
A297167
a(1) = 0, for n > 1, a(n) = -1 + the excess of n (A046660) + the index of the largest prime factor (A061395).
26
0, 0, 1, 1, 2, 1, 3, 2, 2, 2, 4, 2, 5, 3, 2, 3, 6, 2, 7, 3, 3, 4, 8, 3, 3, 5, 3, 4, 9, 2, 10, 4, 4, 6, 3, 3, 11, 7, 5, 4, 12, 3, 13, 5, 3, 8, 14, 4, 4, 3, 6, 6, 15, 3, 4, 5, 7, 9, 16, 3, 17, 10, 4, 5, 5, 4, 18, 7, 8, 3, 19, 4, 20, 11, 3, 8, 4, 5, 21, 5, 4, 12, 22, 4, 6, 13, 9, 6, 23, 3, 5, 9, 10, 14, 7, 5, 24, 4, 5, 4, 25, 6, 26, 7, 3
OFFSET
1,5
FORMULA
a(n) = A252464(n) - A001221(n).
For n > 1, a(n) = A033265(A156552(n)) = A297113(n) - 1.
For n > 1, a(n) = A046660(n) + A061395(n) - 1. - Antti Karttunen, Mar 13 2018
MATHEMATICA
Array[-1 + PrimeOmega@ # - PrimeNu@ # + PrimePi[FactorInteger[#][[-1, 1]]] /. k_ /; k < 0 -> 0 &, 105] (* or, slightly faster *)
Array[-1 + Length@ # - Length@ Union@ # + PrimePi@ Last@ # /. k_ /; k < 0 -> 0 &@ Flatten@ Map[ConstantArray[#1, #2] & @@ # &, #] &@ FactorInteger[#] &, 105] (* Michael De Vlieger, Mar 13 2018 *)
PROG
(PARI)
A061395(n) = if(1==n, 0, primepi(vecmax(factor(n)[, 1]))); \\ After M. F. Hasler's code for A006530.
A252464(n) = if(1==n, 0, (bigomega(n) + A061395(n) - 1));
A297167(n) = (A252464(n) - omega(n));
\\ Or just as:
A297167(n) = if(1==n, 0, (A061395(n) + (bigomega(n)-omega(n)) - 1));
\\ Antti Karttunen, Mar 13 2018
(Scheme) (define (A297167 n) (- (A252464 n) (A001221 n)))
(Python)
from sympy import factorint, primepi
def A297167(n): return primepi(max(f:=factorint(n)))+sum(e-1 for e in f.values())-1 if n>1 else 0 # Chai Wah Wu, Jul 29 2023
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 27 2018
EXTENSIONS
Name changed, original equivalent definition is the first entry in the Formula section - Antti Karttunen, Mar 13 2018
STATUS
approved