Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Question

Commonmark migration
Source Link

###Introduction

Introduction

A pentagonal number (A000326) is generated by the formula Pn= ×ばつ(3n2-n). Or you can just count the amount of dots used:

enter image description here

You can use the formula, or the gif above to find the first few pentagonal numbers:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...

Next, we need to compute the sum of x consecutive numbers.

For example, if x = 4, we need to look at Pn + Pn+1 + Pn+2 + Pn+3 (which consists of 4 terms). If the sum of the pentagonal numbers also is a pentagonal number, we will call this a pentagonal pentagon number.

For x = 4, the smallest pentagonal pentagon number is 330, which is made of 4 consecutive pentagonal numbers: 51, 70, 92, 117. So, when the input is 4, your program of function should output 330.


###Task

Task

  • When given an integer greater than 1, output the smallest pentagonal pentagon number.
  • You may provide a function or a program.
  • Note: There are no solutions for e.g. x = 3. This means that if a number cannot be made from the first 10000 pentagonal numbers, you must stop computing and output whatever fits best for you.
  • This is , so the submission with the least amount of bytes wins!

###Test cases:

Test cases:

Input: 2
Output: 1926 (which comes from 925, 1001)
Input: 3
Output: ?
Input: 4
Output: 330 (which comes from 51, 70, 92, 117)
Input: 5
Output: 44290 (which comes from 8400, 8626, 8855, 9087, 9322)
Input: 6
Output: 651 (which comes from 51, 70, 92, 117, 145, 176)
Input: 7
Output: 287 (which comes from 5, 12, 22, 35, 51, 70, 92)
Input: 8
Output: ?
Input: 9
Output: 12105 (which comes from 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717)
Input: 10
Output: ?

Also bigger numbers can be given:

Input: 37
Output: 32782
Input: 55
Output: 71349465
Input: 71
Output: 24565290

###Introduction

A pentagonal number (A000326) is generated by the formula Pn= ×ばつ(3n2-n). Or you can just count the amount of dots used:

enter image description here

You can use the formula, or the gif above to find the first few pentagonal numbers:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...

Next, we need to compute the sum of x consecutive numbers.

For example, if x = 4, we need to look at Pn + Pn+1 + Pn+2 + Pn+3 (which consists of 4 terms). If the sum of the pentagonal numbers also is a pentagonal number, we will call this a pentagonal pentagon number.

For x = 4, the smallest pentagonal pentagon number is 330, which is made of 4 consecutive pentagonal numbers: 51, 70, 92, 117. So, when the input is 4, your program of function should output 330.


###Task

  • When given an integer greater than 1, output the smallest pentagonal pentagon number.
  • You may provide a function or a program.
  • Note: There are no solutions for e.g. x = 3. This means that if a number cannot be made from the first 10000 pentagonal numbers, you must stop computing and output whatever fits best for you.
  • This is , so the submission with the least amount of bytes wins!

###Test cases:

Input: 2
Output: 1926 (which comes from 925, 1001)
Input: 3
Output: ?
Input: 4
Output: 330 (which comes from 51, 70, 92, 117)
Input: 5
Output: 44290 (which comes from 8400, 8626, 8855, 9087, 9322)
Input: 6
Output: 651 (which comes from 51, 70, 92, 117, 145, 176)
Input: 7
Output: 287 (which comes from 5, 12, 22, 35, 51, 70, 92)
Input: 8
Output: ?
Input: 9
Output: 12105 (which comes from 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717)
Input: 10
Output: ?

Also bigger numbers can be given:

Input: 37
Output: 32782
Input: 55
Output: 71349465
Input: 71
Output: 24565290

Introduction

A pentagonal number (A000326) is generated by the formula Pn= ×ばつ(3n2-n). Or you can just count the amount of dots used:

enter image description here

You can use the formula, or the gif above to find the first few pentagonal numbers:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...

Next, we need to compute the sum of x consecutive numbers.

For example, if x = 4, we need to look at Pn + Pn+1 + Pn+2 + Pn+3 (which consists of 4 terms). If the sum of the pentagonal numbers also is a pentagonal number, we will call this a pentagonal pentagon number.

For x = 4, the smallest pentagonal pentagon number is 330, which is made of 4 consecutive pentagonal numbers: 51, 70, 92, 117. So, when the input is 4, your program of function should output 330.


Task

  • When given an integer greater than 1, output the smallest pentagonal pentagon number.
  • You may provide a function or a program.
  • Note: There are no solutions for e.g. x = 3. This means that if a number cannot be made from the first 10000 pentagonal numbers, you must stop computing and output whatever fits best for you.
  • This is , so the submission with the least amount of bytes wins!

Test cases:

Input: 2
Output: 1926 (which comes from 925, 1001)
Input: 3
Output: ?
Input: 4
Output: 330 (which comes from 51, 70, 92, 117)
Input: 5
Output: 44290 (which comes from 8400, 8626, 8855, 9087, 9322)
Input: 6
Output: 651 (which comes from 51, 70, 92, 117, 145, 176)
Input: 7
Output: 287 (which comes from 5, 12, 22, 35, 51, 70, 92)
Input: 8
Output: ?
Input: 9
Output: 12105 (which comes from 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717)
Input: 10
Output: ?

Also bigger numbers can be given:

Input: 37
Output: 32782
Input: 55
Output: 71349465
Input: 71
Output: 24565290
added 43 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248

###Introduction

A pentagonal number (A000326) is generated by the formula Pn= ×ばつ(3n2-n). Or you can just count the amount of dots used:

[![enter image description here][2]][2]enter image description here

You can use the formula, or the gif above to find the first few pentagonal numbers:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...

Next, we need to compute the sum of x consecutive numbers.

For example, if x = 4, we need to look at Pn + Pn+1 + Pn+2 + Pn+3 (which consists of 4 terms). If the sum of the pentagonal numbers also is a pentagonal number, we will call this a pentagonal pentagon number.

For x = 4, the smallest pentagonal pentagon number is 330, which is made of 4 consecutive pentagonal numbers: 51, 70, 92, 117. So, when the input is 4, your program of function should output 330.


###Task

  • When given an integer greater than 1, output the smallest pentagonal pentagon number.
  • You may provide a function or a program.
  • Note: There are no solutions for e.g. x = 3. This means that if a number cannot be made from the first 10000 pentagonal numbers, you must stop computing and output whatever fits best for you.
  • This is , so the submission with the least amount of bytes wins!

###Test cases:

Input: 2
Output: 1926 (which comes from 925, 1001)
Input: 3
Output: ?
Input: 4
Output: 330 (which comes from 51, 70, 92, 117)
Input: 5
Output: 44290 (which comes from 8400, 8626, 8855, 9087, 9322)
Input: 6
Output: 651 (which comes from 51, 70, 92, 117, 145, 176)
Input: 7
Output: 287 (which comes from 5, 12, 22, 35, 51, 70, 92)
Input: 8
Output: ?
Input: 9
Output: 12105 (which comes from 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717)
Input: 10
Output: ?

Also bigger numbers can be given:

Input: 37
Output: 32782
Input: 55
Output: 71349465
Input: 71
Output: 24565290

###Introduction

A pentagonal number (A000326) is generated by the formula Pn= ×ばつ(3n2-n). Or you can just count the amount of dots used:

[![enter image description here][2]][2]

You can use the formula, or the gif above to find the first few pentagonal numbers:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...

Next, we need to compute the sum of x consecutive numbers.

For example, if x = 4, we need to look at Pn + Pn+1 + Pn+2 + Pn+3 (which consists of 4 terms). If the sum of the pentagonal numbers also is a pentagonal number, we will call this a pentagonal pentagon number.

For x = 4, the smallest pentagonal pentagon number is 330, which is made of 4 consecutive pentagonal numbers: 51, 70, 92, 117. So, when the input is 4, your program of function should output 330.


###Task

  • When given an integer greater than 1, output the smallest pentagonal pentagon number.
  • You may provide a function or a program.
  • Note: There are no solutions for e.g. x = 3. This means that if a number cannot be made from the first 10000 pentagonal numbers, you must stop computing and output whatever fits best for you.
  • This is , so the submission with the least amount of bytes wins!

###Test cases:

Input: 2
Output: 1926 (which comes from 925, 1001)
Input: 3
Output: ?
Input: 4
Output: 330 (which comes from 51, 70, 92, 117)
Input: 5
Output: 44290 (which comes from 8400, 8626, 8855, 9087, 9322)
Input: 6
Output: 651 (which comes from 51, 70, 92, 117, 145, 176)
Input: 7
Output: 287 (which comes from 5, 12, 22, 35, 51, 70, 92)
Input: 8
Output: ?
Input: 9
Output: 12105 (which comes from 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717)
Input: 10
Output: ?

Also bigger numbers can be given:

Input: 37
Output: 32782
Input: 55
Output: 71349465
Input: 71
Output: 24565290

###Introduction

A pentagonal number (A000326) is generated by the formula Pn= ×ばつ(3n2-n). Or you can just count the amount of dots used:

enter image description here

You can use the formula, or the gif above to find the first few pentagonal numbers:

1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...

Next, we need to compute the sum of x consecutive numbers.

For example, if x = 4, we need to look at Pn + Pn+1 + Pn+2 + Pn+3 (which consists of 4 terms). If the sum of the pentagonal numbers also is a pentagonal number, we will call this a pentagonal pentagon number.

For x = 4, the smallest pentagonal pentagon number is 330, which is made of 4 consecutive pentagonal numbers: 51, 70, 92, 117. So, when the input is 4, your program of function should output 330.


###Task

  • When given an integer greater than 1, output the smallest pentagonal pentagon number.
  • You may provide a function or a program.
  • Note: There are no solutions for e.g. x = 3. This means that if a number cannot be made from the first 10000 pentagonal numbers, you must stop computing and output whatever fits best for you.
  • This is , so the submission with the least amount of bytes wins!

###Test cases:

Input: 2
Output: 1926 (which comes from 925, 1001)
Input: 3
Output: ?
Input: 4
Output: 330 (which comes from 51, 70, 92, 117)
Input: 5
Output: 44290 (which comes from 8400, 8626, 8855, 9087, 9322)
Input: 6
Output: 651 (which comes from 51, 70, 92, 117, 145, 176)
Input: 7
Output: 287 (which comes from 5, 12, 22, 35, 51, 70, 92)
Input: 8
Output: ?
Input: 9
Output: 12105 (which comes from 1001, 1080, 1162, 1247, 1335, 1426, 1520, 1617, 1717)
Input: 10
Output: ?

Also bigger numbers can be given:

Input: 37
Output: 32782
Input: 55
Output: 71349465
Input: 71
Output: 24565290
deleted 1014 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248

enter image description here [![enter image description here][2]][2]

Input: 37
Output: 32782
Input: 55
Output: 713494671349465
Input: 71
Output: 24565290

###Proof for x = 3:

First, I was not entirely sure if there were any solutions for x = 3, but for the interested, here is the proof:

A pentagon number is generated with the formula:

enter image description here

For x = 3, this will give us Pn + Pn + 1 + Pn + 2:

enter image description here

enter image description here

enter image description here

This must be a pentagonal number in order to have a solution:

enter image description here

enter image description here

Which has no real solutions. Therefore, there are no solutions for x = 3

enter image description here

Input: 37
Output: 32782
Input: 55
Output: 7134946
Input: 71
Output: 24565290

###Proof for x = 3:

First, I was not entirely sure if there were any solutions for x = 3, but for the interested, here is the proof:

A pentagon number is generated with the formula:

enter image description here

For x = 3, this will give us Pn + Pn + 1 + Pn + 2:

enter image description here

enter image description here

enter image description here

This must be a pentagonal number in order to have a solution:

enter image description here

enter image description here

Which has no real solutions. Therefore, there are no solutions for x = 3

[![enter image description here][2]][2]

Input: 37
Output: 32782
Input: 55
Output: 71349465
Input: 71
Output: 24565290
added 1014 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
added 19 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
deleted 107 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
edited body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
edited body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
added 1 character in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248
Loading

AltStyle によって変換されたページ (->オリジナル) /