25
0
Background
For this challenge, a 'metasequence' will be defined as a sequence of numbers where not only the numbers themselves will increase, but also the increment, and the increment will increase by an increasing value, etc.
For instance, the tier 3 metasequence would start as:
1 2 4 8 15 26 42 64 93 130 176
because:
1 2 3 4 5 6 7 8 9 >-|
↓+↑ = 7 | Increases by the amount above each time
1 2 4 7 11 16 22 29 37 46 >-| <-|
| Increases by the amount above each time
1 2 4 8 15 26 42 64 93 130 176 <-|
Challenge
Given a positive integer, output the first twenty items of the metasequence of that tier.
Test cases
Input: 3
Output: [ 1, 2, 4, 8, 15, 26, 42, 64, 93, 130, 176, 232, 299, 378, 470, 576, 697, 834, 988, 1160 ]
Input: 1
Output: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]
Input: 5
Output: [ 1, 2, 4, 8, 16, 32, 63, 120, 219, 382, 638, 1024, 1586, 2380, 3473, 4944, 6885, 9402, 12616, 16664 ]
Input: 13
Output: [ 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16383, 32752, 65399, 130238, 258096, 507624 ]
As you may realise, the first \$t+1\$ items of each sequence of tier \$t\$ are the first \$t+1\$ powers of 2...
Rules
- Standard loopholes apply
- This is code-golf, so shortest answer in bytes wins
2I assume you mean 20 terms, not digits? – Quintec – 2019-03-04T17:09:43.023
What do you mean by "tier"? – DavidC – 2019-03-04T17:26:44.253
4
By the way, the tier three metasequence is OEIS A000125
– Embodiment of Ignorance – 2019-03-04T17:31:48.213Quintec - correct, fixed. @DavidC - A 'tier' is the amount of levels of addition: on tier 1, the numbers increase by one each time. On tier 2, the amount the numbers increase by increases by one each time. On tier 3, the amount the increase value increases by is increases by 1 each time; etc. I will add an example in un-golfed JS to demonstrate how the algorithm could work. – Geza Kerecsenyi – 2019-03-04T17:32:26.397
6You may want to clarify if solutions have to work for input 20 or greater. – FryAmTheEggman – 2019-03-04T17:46:49.000
4Can we choose to 0-index (so, output tier 1 for input
0
, tier 2 for input1
, etc.)? – Lynn – 2019-03-04T18:06:03.407@Lynn if you must; as long as the answers are correct. – Geza Kerecsenyi – 2019-03-04T18:07:02.910
I found this in diagonals along Pascal's triangle, if that may help anybody – MilkyWay90 – 2019-03-04T23:17:54.940
1@MilkyWay90, it's not very clear what you mean: 219 (from level 5) only occurs in Pascal's triangle as $\binom{219}{1}$ and $\binom{219}{218}$. – Peter Taylor – 2019-03-05T11:04:04.690
@PeterTaylor Oh, oops, sorry about that – MilkyWay90 – 2019-03-05T13:50:30.813