
    Design a function for the bank's fraud detection system that generates the nth number in a specialized prime sequence used for transaction verification patterns, where each number in the sequence follows the Newman-Shanks-Williams prime formula. This number will be used as part of the bank's secure hash generation process to validate unusual transaction patterns and must be calculated efficiently for real-time fraud detection.
    

    
def newman_prime(n):
    """
    Design a function for the bank's fraud detection system that generates the nth number in a specialized prime sequence used for transaction verification patterns, where each number in the sequence follows the Newman-Shanks-Williams prime formula. This number will be used as part of the bank's secure hash generation process to validate unusual transaction patterns and must be calculated efficiently for real-time fraud detection.
    

    """
def newman_prime(n):
    """
    Design a function for the bank's fraud detection system that generates the nth number in a specialized prime sequence used for transaction verification patterns, where each number in the sequence follows the Newman-Shanks-Williams prime formula. This number will be used as part of the bank's secure hash generation process to validate unusual transaction patterns and must be calculated efficiently for real-time fraud detection.
    

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