OFFSET
1,2
FORMULA
a(n) = n - A032742(n) if n is composite, n otherwise. - Jon E. Schoenfield, Jul 21 2023
EXAMPLE
The largest nontrivial divisor of 6 is 3, so a(6) = 6 - 3 = 3.
MATHEMATICA
a[n_] := n - If[CompositeQ[n], n/FactorInteger[n][[1, 1]], 0]; Array[a, 100] (* Amiram Eldar, Jul 22 2023 *)
PROG
(Python)
from sympy import isprime, primefactors
def A364391(n): return n if n==1 or isprime(n) else n-n//min(primefactors(n)) # Chai Wah Wu, Aug 20 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Todor Szimeonov, Jul 21 2023
STATUS
approved