#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1172
Task: ‘$$
</think>

Write a Python function that calculates the next financial milestone toward retirement based on current savings, monthly contributions, and annual interest rate.
Generated: 2026-02-12T22:58:11.294386
"""

import math

def calculate_next_milestone(current_savings, monthly_contribution, annual_interest_rate, target_savings):
    monthly_interest_rate = annual_interest_rate / 12 / 100
    months = 0
    savings = current_savings

    while savings < target_savings:
        savings += monthly_contribution
        savings *= (1 + monthly_interest_rate)
        months += 1

    years = months / 12
    return years

if __name__ == '__main__':
    current_savings = 50000
    monthly_contribution = 2000
    annual_interest_rate = 5.5
    target_savings = 1000000

    years_to_milestone = calculate_next_milestone(current_savings, monthly_contribution, annual_interest_rate, target_savings)
    print(f"Years to reach retirement milestone: {years_to_milestone:.2f}")