
    Design an algorithm for an adaptive learning system that generates mathematical sequence problems by calculating the nth number in a specialized academic sequence where each term is determined by the formula p(n) = 2p(n-1) - p(n-2) with initial values p(0) = 1 and p(1) = 1, and then selecting only the prime numbers from this sequence. The system should use the student's current difficulty level n to determine which number in this sequence to present, helping to progressively challenge students' understanding of number patterns and prime numbers.
    

    
def newman_prime(n):
    """
    Design an algorithm for an adaptive learning system that generates mathematical sequence problems by calculating the nth number in a specialized academic sequence where each term is determined by the formula p(n) = 2p(n-1) - p(n-2) with initial values p(0) = 1 and p(1) = 1, and then selecting only the prime numbers from this sequence. The system should use the student's current difficulty level n to determine which number in this sequence to present, helping to progressively challenge students' understanding of number patterns and prime numbers.
    

    """
def newman_prime(n):
    """
    Design an algorithm for an adaptive learning system that generates mathematical sequence problems by calculating the nth number in a specialized academic sequence where each term is determined by the formula p(n) = 2p(n-1) - p(n-2) with initial values p(0) = 1 and p(1) = 1, and then selecting only the prime numbers from this sequence. The system should use the student's current difficulty level n to determine which number in this sequence to present, helping to progressively challenge students' understanding of number patterns and prime numbers.
    

    """
    if n == 0 or n == 1:
        return 1
    return 2 * newman_prime(n - 1) + newman_prime(n - 2)