19
1
I define the method of combining a sequence to mean that every number in the sequence is concatenated as a string, then that result is made an integer.
[1, 2, 3] -> 123
For every finite sequence of at least 3 consecutive integers, missing exactly one element in the sequence, and this missing element may not be the first or last element in the sequence, output the integer resulting from the combined sequence. I am referring to this as a "singly lossy integer".
[1, 2, 3] -> {1, 3} (missing an element) -> 13
This sequence of singly lossy integers is the union of the following subsequences (partitions?):
The first subsequence {n, n+2}
is A032607.
{n, n+2} -> 13, 24, 35, 46, 57, 68, 79, 810, 911, 1012, ...
{n, n+1, n+3} -> 124, 235, 346, ...
{n, n+2, n+3} -> 134, 245, 356, ...
{n, n+1, n+2, n+4} -> 1235, 2346, 3457, ...
{n, n+1, n+3, n+4} -> 1245, 2356, 3467, ...
{n, n+2, n+3, n+4} -> 1345, 2456, 3567, ...
...
for n ∈ ℕ (integers >= 1)
These integers must be printed in ascending order. The first 25 singly lossy integers are below:
13, 24, 35, 46, 57, 68, 79, 124, 134, 235, 245, 346, 356, 457, 467, 568, 578, 679, 689, 810, 911, 1012, 1113, 1214, 1235, ...
First 7597 Singly Lossy Integers
Ungolfed reference implementations. I made it to be faster, rather than smaller.
Rules:
- Shortest code wins
- You may either (say which one):
- Print the singly lossy integers forever
- Given a positive integer n, print or return the first n elements as a list, or a comma- or whitespace- delimited string.
- You should support arbitrarily large integers if your language allows it, especially if you're printing forever.
Note: There is not yet an entry in the OEIS for this sequence.
Another note: I named them the "Singly Lossy Integers" so that there could in turn be "Doubly Lossy Integers", "N-ly Lossy Integers", "(N+1)-ly Lossy Integers", and the "Lossy Integers" (union of all of these).
I added a list of the first ~7600 elements, as well as a reference implementation I just completed in Python. – mbomb007 – 2016-02-22T22:10:25.837
2This would be a fun
fastest-code
challenge. – Michael Klein – 2016-02-23T01:13:22.713That it would. Is it acceptable to re-post a challenge but with a different winning criterion? If so, I'd wait a week or more first anyway. – mbomb007 – 2016-02-23T04:19:10.420
As far as I know, it should be fine. Might want to pop into chat to ask a mod though, just in case/for tips. – Michael Klein – 2016-02-23T04:23:33.163