
    Given a user's engagement pattern represented as a numerical sequence, develop a function that determines the next higher possible engagement pattern by rearranging the sequence digits, which will be used to identify similar but slightly more active users for content recommendations. The new pattern must be the smallest possible number greater than the original pattern using the same digits, ensuring optimal content matching while maintaining user similarity.
    

    
def rearrange_bigger(n):
    """
    Given a user's engagement pattern represented as a numerical sequence, develop a function that determines the next higher possible engagement pattern by rearranging the sequence digits, which will be used to identify similar but slightly more active users for content recommendations. The new pattern must be the smallest possible number greater than the original pattern using the same digits, ensuring optimal content matching while maintaining user similarity.
    

    """
def rearrange_bigger(n):
    """
    Given a user's engagement pattern represented as a numerical sequence, develop a function that determines the next higher possible engagement pattern by rearranging the sequence digits, which will be used to identify similar but slightly more active users for content recommendations. The new pattern must be the smallest possible number greater than the original pattern using the same digits, ensuring optimal content matching while maintaining user similarity.
    

    """
    nums = list(str(n))
    for i in range(len(nums) - 2, -1, -1):
        if nums[i] < nums[i + 1]:
            z = nums[i:]
            y = min(filter(lambda x: x > z[0], z))
            z.remove(y)
            z.sort()
            nums[i:] = [y] + z
            return int(''.join(nums))
    return False