package chapter_5;
/**
*
* @author jason
*/
public class Five_One {
public static void main(String[] args) {
for (int k = 1; k < 11; k++) {
for (int n = 1; n < 11; n++) {
System.out.print(getPentagonalNumber(n)+ "t");
}
System.out.println();
}
}
public static int getPentagonalNumber(int n) {
return n * (3 * n - 1) / 2;
}
}
public static void main(String[] args) {
for (int k =0; k < 10; k++) { //range is [0,10) instead [1,11)
for (int n = 1; n < 11; n++) {
System.out.print(getPentagonalNumber((10*k)+n)+ "t"); //10*k + n instead of n
}
System.out.println();
}
}
System.out.print(getPentagonalNumber((k-1) * 10 + n) + "t");
for (int i = 0; i < 100; i++) {
System.out.print(getPentagonalNumber(i + 1) + "t");
if (i % 10 == 0) {
System.out.println();
}
}
getPentagonalNumber(n)
getPentagonalNumber((k-1) * 10 + n)