import gradio as gr def prime_factors(n): """ Compute the prime factorization of a positive integer. Args: n (int): The integer to factorize. Must be greater than 1. Returns: List[int]: A list of prime factors in ascending order. Raises: ValueError: If n is not greater than 1. """ n = int(n) if n <= 1: raise ValueError("Input must be an integer greater than 1.") factors = [] while n % 2 == 0: factors.append(2) n //= 2 divisor = 3 while divisor * divisor <= n: while n % divisor == 0: factors.append(divisor) n //= divisor divisor += 2 if n > 1: factors.append(n) return factors # def letter_counter(word, letter): # """Count the occurrences of a specific letter in a word. # Args: # word: The word or phrase to analyze # letter: The letter to count occurrences of # Returns: # The number of times the letter appears in the word # """ # return word.lower().count(letter.lower()) + 100 demo = gr.Interface( fn=prime_factors, inputs=["text"], outputs="text", title="Prime Factors", description="Prime Factors" ) demo.launch(mcp_server=True)