
    Write a function to determine if a user's profile ID number follows a special pattern where it equals one less than twice its reverse, as this indicates users who joined through connected referral chains and should be prioritized for friend recommendations. For example, if a user's ID is 241, its reverse is 142, and we need to 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 user's profile ID number follows a special pattern where it equals one less than twice its reverse, as this indicates users who joined through connected referral chains and should be prioritized for friend recommendations. For example, if a user's ID is 241, its reverse is 142, and we need to 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 user's profile ID number follows a special pattern where it equals one less than twice its reverse, as this indicates users who joined through connected referral chains and should be prioritized for friend recommendations. For example, if a user's ID is 241, its reverse is 142, and we need to check if 241 = (2 × 142) - 1.
    

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