Connection
Base URL, credentials and a reachable server.
Track removed prime factors alongside the totient accumulator so the special input one and repeated factors remain visible during review.
Base URL, credentials and a reachable server.
A model available through the configured endpoint.
Context limits and tool support are determined by the model and server.
def totient(value):
if type(value) is not int or not 1 <= value <= 1000000000:
raise ValueError("value.range")
remaining, result, factor = value, value, 2
while factor * factor <= remaining:
if remaining % factor == 0:
result -= result // factor
while remaining % factor == 0:
remaining //= factor
factor += 1
if remaining > 1:
result -= result // remaining
return result