# Pentagonal numbers

## Project Euler 78: Investigating the number of ways in which coins can be separated into piles.

Problem 78 of Project Euler has been in my scope for a long time, since it is the first exercise on the list which is solved by less than 5000 people at the time of writing this post. The problem reads

Let p(n) represent the number of different ways in which n coins can be separated into piles. For example, five coins can separated into piles in exactly seven different ways, so p(5)=7.

 OOOOO OOOO   O OOO   OO OOO   O   O OO   OO   O OO   O   O   O O   O   O   O   O

Find the least value of n for which p(n) is divisible by one million.

Posted by Kristian in Project Euler, 10 comments

## Project Euler 61: Find the sum of the only set of six 4-digit figurate numbers with a cyclic property

For some reason Problem 61 of Project Euler is a problem that not so many people have solved compared to the problems in the sixties range.  However, I think that it was a quite approachable problem which was fun to solve.  The problem reads

Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae:

 Triangle P3,n=n(n+1)/2 1, 3, 6, 10, 15, … Square P4,n=n2 1, 4, 9, 16, 25, … Pentagonal P5,n=n(3n-1)/2 1, 5, 12, 22, 35, … Hexagonal P6,n=n(2n-1) 1, 6, 15, 28, 45, … Heptagonal P7,n=n(5n-3)/2 1, 7, 18, 34, 55, … Octagonal P8,n=n(3n-2) 1, 8, 21, 40, 65, …

The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties.

1. The set is cyclic, in that the last two digits of each number is the first two digits of the next number (including the last number with the first).
2. Each polygonal type: triangle (P3,127=8128), square (P4,91=8281), and pentagonal (P5,44=2882), is represented by a different number in the set.
3. This is the only set of 4-digit numbers with this property.

Find the sum of the only ordered set of six cyclic 4-digit numbers for which each polygonal type: triangle, square, pentagonal, hexagonal, heptagonal, and octagonal, is represented by a different number in the set.

Posted by Kristian in Project Euler, 4 comments

## Project Euler 45: After 40755, what is the next triangle number that is also pentagonal and hexagonal?

Problem 45 of Project Euler reads

Triangle, pentagonal, and hexagonal numbers are generated by the following formulae:

 Triangle Tn=n(n+1)/2 1, 3, 6, 10, 15, … Pentagonal Pn=n(3n-1)/2 1, 5, 12, 22, 35, … Hexagonal Hn=n(2n-1) 1, 6, 15, 28, 45, …

It can be verified that T285 = P165 = H143 = 40755.

Find the next triangle number that is also pentagonal and hexagonal.

Posted by Kristian in Project Euler, 13 comments

## Project Euler 44: Find the smallest pair of pentagonal numbers whose sum and difference is pentagonal.

In Problem 42 we dealt with triangular problems, in Problem 44 of Project Euler we deal with pentagonal number, I can only wonder if we have to deal with septagonal numbers in Problem 46. Anyway the problem reads

Pentagonal numbers are generated by the formula, Pn=n(3n-1)/2. The first ten pentagonal numbers are:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, …

It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 – 22 = 48, is not pentagonal.

Find the pair of pentagonal numbers, Pj and Pk, for which their sum and difference is pentagonal and D = |Pk – Pj| is minimised; what is the value of D?

Posted by Kristian in Project Euler, 43 comments