
    Design a function for an automated grading system that calculates the nth number in a specialized sequence used to assess students' understanding of advanced number theory. The sequence follows the Newman-Shanks-Williams prime pattern, where each number must be determined based on its position n in the sequence, enabling teachers to generate varied practice problems and evaluate students' comprehension of mathematical sequences.
    

    
def newman_prime(n):
    """
    Design a function for an automated grading system that calculates the nth number in a specialized sequence used to assess students' understanding of advanced number theory. The sequence follows the Newman-Shanks-Williams prime pattern, where each number must be determined based on its position n in the sequence, enabling teachers to generate varied practice problems and evaluate students' comprehension of mathematical sequences.
    

    """
def newman_prime(n):
    """
    Design a function for an automated grading system that calculates the nth number in a specialized sequence used to assess students' understanding of advanced number theory. The sequence follows the Newman-Shanks-Williams prime pattern, where each number must be determined based on its position n in the sequence, enabling teachers to generate varied practice problems and evaluate students' comprehension of mathematical sequences.
    

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