from typing import Dict


def calculate_possibilities(max: int) -> Dict[int, int]:
    """Calculate the numbers of lucky numbers from 0 to 10**(max - 1)"""
    possibilities: Dict[int, int] = { 0: 0, 1: 2 }
    index: int = 2
    while index < max:
        possibilities[index] = 2 * (9 ** (index - 1)) + 8 * possibilities[index - 1]
        index += 1
    return possibilities