
    Write a function to determine if a portfolio identifier number follows the special regulatory pattern where it equals one less than twice its reverse digits, which is required for certain high-risk investment categories. For example, if a portfolio ID is 241, its reverse is 142, and the function should check if 241 = (2 × 142) - 1.
    

    
def rev(num):
    rev_num = 0
    while num > 0:
        rev_num = rev_num * 10 + num % 10
        num = num // 10
    return rev_num

def check(n):
    """
    Write a function to determine if a portfolio identifier number follows the special regulatory pattern where it equals one less than twice its reverse digits, which is required for certain high-risk investment categories. For example, if a portfolio ID is 241, its reverse is 142, and the function should check if 241 = (2 × 142) - 1.
    

    """
def rev(num):
    rev_num = 0
    while num > 0:
        rev_num = rev_num * 10 + num % 10
        num = num // 10
    return rev_num

def check(n):
    """
    Write a function to determine if a portfolio identifier number follows the special regulatory pattern where it equals one less than twice its reverse digits, which is required for certain high-risk investment categories. For example, if a portfolio ID is 241, its reverse is 142, and the function should check if 241 = (2 × 142) - 1.
    

    """
    return 2 * rev(n) == n + 1