/**
 * Calculates the total mass of all stars in a given sequence.
 * The mass of each star is multiplied by its corresponding index in the sequence,
 * and then summed up to get the total mass.
 *
 * @param stars A sequence containing the masses of stars.
 * @return The total mass of all stars.
 */
fun calcTotalMass(stars: List<Double>): Double {

    var totalMass = 0.0
    for ((index, starMass) in stars.withIndex()) {
        // Multiply the current star's mass by its index and assign it to the product
        val product = starMass * index

        // Multiply the total mass by the product and assign it back to the totalMass variable
        totalMass += product
    }
    return totalMass
}
/**
 * Calculates the total mass of all stars in a given sequence.
 * The mass of each star is multiplied by its corresponding index in the sequence,
 * and then summed up to get the total mass.
 *
 * @param stars A sequence containing the masses of stars.
 * @return The total mass of all stars.
 */
fun calcTotalMass(stars: List<Double>): Double {
/**
 * Calculates the total mass of all stars in a given sequence.
 * The mass of each star is multiplied by its corresponding index in the sequence,
 * and then summed up to get the total mass.
 *
 * @param stars A sequence containing the masses of stars.
 * @return The total mass of all stars.
 */
fun calcTotalMass(stars: List<Double>): Double {

    var totalMass = 0.0
    for ((index, starMass) in stars.withIndex()) {
        // Multiply the current star's mass by its index and assign it to the product
        val product = starMass * index

        // Multiply the total mass by the product and assign it back to the totalMass variable
        totalMass += product
    }
    return totalMass
}