
    Write a function that determines if a transit vehicle's identification number follows the maintenance alert pattern, where the VIN is exactly one less than double its reverse sequence - a pattern used to flag vehicles for immediate inspection. For example, if a VIN reads as 2178, its reverse (8712) multiplied by 2 minus 1 should equal the original VIN to trigger the maintenance alert.
    

    
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 that determines if a transit vehicle's identification number follows the maintenance alert pattern, where the VIN is exactly one less than double its reverse sequence - a pattern used to flag vehicles for immediate inspection. For example, if a VIN reads as 2178, its reverse (8712) multiplied by 2 minus 1 should equal the original VIN to trigger the maintenance alert.
    

    """
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 that determines if a transit vehicle's identification number follows the maintenance alert pattern, where the VIN is exactly one less than double its reverse sequence - a pattern used to flag vehicles for immediate inspection. For example, if a VIN reads as 2178, its reverse (8712) multiplied by 2 minus 1 should equal the original VIN to trigger the maintenance alert.
    

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