Phase 6 - Category 4: Mathematical Combinations
Combine mathematical concepts with programming logic.
10 programs · open one, then the next
Start with Sum of Squares- 01Sum of SquaresIntermediateSum integer squares through n as a final accumulation exercise. Students trace one square per term and compare the loop with the closed-form result if desired.Open example →py# Take n n = int(input("Enter n: ")) # Calculate sum of squares
- 02Sum of CubesIntermediateAdd cubes from one through n with a running total. Students trace term construction and distinguish summing cubed values from cubing the final ordinary sum.Open example →py# Take n n = int(input("Enter n: ")) # Calculate sum of cubes
- 03Alternating SumIntermediateEvaluate one minus two plus three minus four through n in Python. Students use position parity to choose a term's sign and trace the alternating running total.Open example →py# Take n n = int(input("Enter n: ")) # Calculate alternating sum
- 04Harmonic Series SumIntermediateCalculate a numeric harmonic sum with floating-point division. Students add reciprocals to a float total rather than printing the symbolic fraction expression.Open example →py# Take n n = int(input("Enter n: ")) # Calculate harmonic sum
- 05Geometric Series SumIntermediateSum a finite geometric series with powers and a loop. Students accept decimal terms and ratios and see why the ratio-one case works without a special formula.Open example →py# Take inputs a = float(input("Enter first term (a): ")) r = float(input("Enter common ratio (r): ")) n = int(input("Enter number of terms (n): "))
- 06Print Nth Row of Pascal TriangleAdvancedPrint a zero-based Pascal-triangle row with recursive combinations. Students calculate each nCr and trace edge values that stop the recursive branching.Open example →py# Helper function def ncr(n, r): if r == 0 or r == n: return 1
- 07Catalan NumbersAdvancedGenerate Catalan numbers with a recursive recurrence. Students trace products of smaller counts and recognize repeated work before trying large term counts.Open example →py# Helper function def catalan(n): if n == 0: return 1
- 08Tribonacci SeriesIntermediatePrint a Tribonacci sequence using three previous terms in Python. Students handle short requested counts and update a three-value window after each new sum.Open example →py# Take n n = int(input("Enter number of terms: ")) # Generate Tribonacci
- 09Lucas SeriesIntermediateGenerate Lucas numbers with a two-value update. Students compare Lucas starting values with Fibonacci and trace the same addition rule on different seeds.Open example →py# Take n n = int(input("Enter number of terms: ")) # Generate Lucas series
- 10Pell SeriesAdvancedGenerate Pell numbers with pair updates. Students multiply the previous term by two before adding the earlier term and handle short sequence counts explicitly.Open example →py# Take n n = int(input("Enter number of terms: ")) # Generate Pell series