#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1261
Task: ,

Write a Python function that calculates the number of years required to retire given a current age, annual savings, and target retirement amount, assuming a fixed annual interest rate.
Generated: 2026-02-13T02:06:57.980625
"""

import math

def years_to_retire(current_age, annual_savings, target_amount, interest_rate):
    years = 0
    current_savings = 0

    while current_savings < target_amount:
        current_savings += annual_savings
        current_savings *= (1 + interest_rate)
        years += 1

    return years

if __name__ == '__main__':
    current_age = 30
    annual_savings = 15000
    target_amount = 1000000
    interest_rate = 0.05  # 5% annual interest rate

    years = years_to_retire(current_age, annual_savings, target_amount, interest_rate)
    print(f"Years required to retire: {years}")