<jupyter_start><jupyter_text>![](![pol_econ_power%20%2812%29.png](attachment:pol_econ_power%20%2812%29.png)<jupyter_code>import math

def get_catch_up_msg(a, b, growth_a, growth_b, base_a, base_b):
    num_years = math.log(base_b / base_a, ((100 + growth_a) / (100 + growth_b)))
    msg = (
        'Assume {a} grows at {growth_a}%, {b} {growth_b}%, '
        'it would take {a} {0:.2f} years to catch up.'
    )
    return msg.format(num_years, **locals())
    
print(get_catch_up_msg('China', 'Hong Kong', 8, 0, 10000, 49000))
print(get_catch_up_msg('China', 'Hong Kong', 8, 2, 10000, 49000))<jupyter_output>Assume China grows at 8%, Hong Kong 0%, it would take China 20.65 years to catch up.
Assume China grows at 8%, Hong Kong 2%, it would take China 27.80 years to catch up.<jupyter_text>> Taiwan, China, is not listed as a separate country for World Development Indicators. > For most indicators, Taiwan, China, data is not added to the data for China, > but Taiwan, China, is added to the world aggregate and the high-income countries aggregate.>> -- [World Bank](https://datahelpdesk.worldbank.org/knowledgebase/articles/114933-where-are-your-data-on-taiwan)<jupyter_code>def get_num_years_to_current_level(current_level, starting_level, starting_rate, rate_decrease_per_ten_years):
    level = starting_level
    rate = starting_rate
    for idx, _ in enumerate(range(100)):
        level *= (1 + rate / 100)
        if idx % 10 == 0 and idx > 0:
            rate -= rate_decrease_per_ten_years
            if rate < 0:
                break
        if level > current_level:
            return(idx)

print(get_num_years_to_current_level(49000, 10000, 8, 2))
def get_level_after_thirty_years(starting_level, starting_rate, rate_decrease_per_ten_years):
    level = starting_level
    rate = starting_rate
    for idx in range(30):
        level *= (1 + rate / 100)
        if idx % 10 == 0 and idx > 0:
            rate -= rate_decrease_per_ten_years
    return level
print(get_level_after_thirty_years(10000, 8, 2))
49000 * 1.02 ** 30<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11475409836065574, 'fraction_numerical': 0.05641272902603665, 'mean_word_length': 3.748283752860412, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 16, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '619881', 'license': 'MIT', 'n_tokens_mistral': 824, 'n_tokens_neox': 702, 'n_words': 196, 'path': 'Democracy vs GDP per capita.ipynb', 'repo_name': 'dantam/DataRocks', 'size': '2074'}