# (Math: pentagonal numbers) java

Anonymous
account_balance_wallet \$55

Question description

6-1) (Math: pentagonal numbers) A pentagonal number is defined as n(3n–1)/2 for n = 1, 2, . . ., and so on. Therefore, the first few numbers are 1, 5, 12, 22, . . . . Write a method  with the following header that returns a pentagonal number:

public static int  getPentagonalNumber(int  n)

Write a test program  that uses this method  to display the first n pentagonal
numbers with 10 numbers on each line, one space between  each number, and the user entering the integer value  for n.

### SAMPLE RUN #1

#### --- Prompts For Keyboard/Console/Standard Input ---

Enter an integer  for the n pentagonal numbers you want displayed:

20

### Outputs

#### --- Monitor/Console/Standard Output  ---

Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590

### What The Console Looks Like In An Interactive Session:

#### (Note: this combines standard input with standard output )

>java PentagonalNumbers
Enter an integer  for the n pentagonal numbers you want displayed: 20
1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590

### SAMPLE RUN #2

#### --- Prompts For Keyboard/Console/Standard Input ---

Enter an integer  for the n pentagonal numbers you want displayed:

33

### Outputs

#### --- Monitor/Console/Standard Output  ---

Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590
651 715 782 852 925 1001 1080 1162 1247 1335
1426 1520 1617

### What The Console Looks Like In An Interactive Session:

#### (Note: this combines standard input with standard output )

>java PentagonalNumbers
Enter an integer  for the n pentagonal numbers you want displayed: 33
1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590
651 715 782 852 925 1001 1080 1162 1247 1335
1426 1520 1617

### SAMPLE RUN #3

#### --- Prompts For Keyboard/Console/Standard Input ---

Enter an integer  for the n pentagonal numbers you want displayed:

67

### Outputs

#### --- Monitor/Console/Standard Output  ---

Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590
651 715 782 852 925 1001 1080 1162 1247 1335
1426 1520 1617 1717 1820 1926 2035 2147 2262 2380
2501 2625 2752 2882 3015 3151 3290 3432 3577 3725
3876 4030 4187 4347 4510 4676 4845 5017 5192 5370
5551 5735 5922 6112 6305 6501 6700

### What The Console Looks Like In An Interactive Session:

#### (Note: this combines standard input with standard output )

>java PentagonalNumbers
Enter an integer  for the n pentagonal numbers you want displayed: 67
1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590
651 715 782 852 925 1001 1080 1162 1247 1335
1426 1520 1617 1717 1820 1926 2035 2147 2262 2380
2501 2625 2752 2882 3015 3151 3290 3432 3577 3725
3876 4030 4187 4347 4510 4676 4845 5017 5192 5370
5551 5735 5922 6112 6305 6501 6700

### SAMPLE RUN #4

#### --- Prompts For Keyboard/Console/Standard Input ---

Enter an integer  for the n pentagonal numbers you want displayed:

43

### Outputs

#### --- Monitor/Console/Standard Output  ---

Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590
651 715 782 852 925 1001 1080 1162 1247 1335
1426 1520 1617 1717 1820 1926 2035 2147 2262 2380
2501 2625 2752

### What The Console Looks Like In An Interactive Session:

#### (Note: this combines standard input with standard output )

>java PentagonalNumbers
Enter an integer  for the n pentagonal numbers you want displayed: 43
1 5 12 22 35 51 70 92 117 145
176 210 247 287 330 376 425 477 532 590
651 715 782 852 925 1001 1080 1162 1247 1335
1426 1520 1617 1717 1820 1926 2035 2147 2262 2380
2501 2625 2752
compile w NetBeans

Cornell University

flag Report DMCA
Review

Anonymous
Thanks, good work

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors