login
A364391
a(n) = n - (largest nontrivial divisor of n, or 0 if there is none).
2
1, 2, 3, 2, 5, 3, 7, 4, 6, 5, 11, 6, 13, 7, 10, 8, 17, 9, 19, 10, 14, 11, 23, 12, 20, 13, 18, 14, 29, 15, 31, 16, 22, 17, 28, 18, 37, 19, 26, 20, 41, 21, 43, 22, 30, 23, 47, 24, 42, 25, 34, 26, 53, 27, 44, 28, 38, 29, 59, 30, 61, 31, 42, 32, 52, 33, 67, 34, 46, 35
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
Sequence in context: A363627 A073890 A079311 * A060474 A065988 A335285
KEYWORD
nonn
AUTHOR
Todor Szimeonov, Jul 21 2023
STATUS
approved