13
0
The oldest Polish salt mine, located in Bochnia*, was started in year 1248, which we can consider a magical number. We can see that it's equal to 4 digits from the sequence of exponentiations: .
As the date is actually 4 digits from the sequence, we could make it longer. We could repeat the process until we reach infinity. The sequence would look like this, if we limit it to number 2048
124816326412825651210242048
To make it look a bit better, we can separate the numbers:
1|2|4|8|16|32|64|128|256|512|1024|2048
Let's try a custom, longer sequence than the date. Let's say, we want it to have 5 digits - there are more than one possibility:
24816
81632
64128
Or 3 digit ones:
124
248
816
We could also add the 3 digit numbers to this, but let's say, that a sequence must have at least two numbers.
* There is no information about this on the English Wikipedia. If you enter the Polish version - then there is. If you visit the mine, the workers will also tell you, that it started in 1248.
The challenge
Create a exponentiation sequence like in examples above with 2 as the base.
Given a number from range 2-27, output all possible parts of the sequence (The 2048 one or larger if you want) with amount of digits equal to the input. You cannot cut a number, so output like 481
is invalid, because 16 is cut in half.
Rules:
- Standard loopholes are forbidden.
- You can assume the input is a number inside the range.
- Your program can accept inputs larger than the range (28+), but that won't increase/decrease score.
- Spaces in output are ignored. You can output like
124
or like4 8 16
. - Different possibilities should be separated by any character from the list:
,./|
or a line feed. - You can output as an array.
- Every possibility should include at least 2 different numbers.
- You must output a part of the sequence, you cannot mix numbers that aren't next to each other, like:
14
. - Hardcoded output isn't allowed, however, you can hardcode a string/number/array containing the full sequence.
- Input 27 should return the full 2048 sequence.
- As already mentioned before, do not cut numbers. Ex.
16
must stay16
- you can't use481
- you must use4816
. - EDIT: I might have said something wrong there; 2048 is the last number which your program should support, you can add support for larger int's.
Test cases
Input: 2
12, 24, 48
Input: 3
124, 248, 816
Input: 4
1248, 4816, 1632, 3264
Input: 5
24816, 81632, 64128
Input: 27
124816326412825651210242048
And later numbers...
If I made a mistake in any of the test cases, tell me or edit the question.
This is code-golf, so the shortest code in bytes wins!
1So this is only with 2 as the base, correct? Could you clarify that in the question? I'm not sure if it's implied by "Sequence of Exponentiations," but even if it is, I'm sure there are people out there like me who don't know that. – cole – 2017-09-12T16:56:01.450
@cole Actually, yes, it's only with 2. Thanks for mentioning! – RedClover – 2017-09-12T16:56:49.313
1Can output be separated by newline? – H.PWiz – 2017-09-12T17:23:51.877
@H.PWiz Actually, why not? Let me just edit the question. – RedClover – 2017-09-12T17:24:42.217
I can't say that I don't keep upvoting every single answer here. The genius of people on ppcg is just amazing. – RedClover – 2017-09-12T17:48:50.750
Does the output order matter? – Shaggy – 2017-09-13T07:41:56.007
@Shaggy No. You can output in any order you want. – RedClover – 2017-09-13T07:46:15.513
Pushing my luck here but would this be an acceptable form of output?
– Shaggy – 2017-09-13T20:14:48.043@Shaggy No. I don't think I should allow it. I never seen anything output this way. – RedClover – 2017-09-13T20:17:58.150
1
No worries; like I said, I was pushing it. Some challenge authors can be incredibly flexible on the output format so, for the sake of a byte or 2, it's worth asking ;) (Note: That should not be interpreted as a suggestion!)
– Shaggy – 2017-09-13T22:27:18.607You are missing
163264128256512102420484096
and641282565121024204840968192
from the sequence generated from 27. – kamoroso94 – 2017-09-14T04:07:16.297@kamoroso94 No, I'm not. I stated that if you want to support larger sequences than 2048, you can. But it's optional – RedClover – 2017-09-14T04:27:00.290
1
In the intro, you should capitalize Polish. "polish" is a different English word.
– Peter Cordes – 2017-09-17T03:45:28.740