package cn.edu.bjut.chapter2; public class TwoPowerSummation { public static void main(String[] args) { int sum = 0; for (int n = 1; n <= 20; n++) { sum += (int) Math.pow(2, n) - 1; } System.out.println(sum); } }