### Meanwhile, I'm still thinking...

I took a quick look at

One thing we can do, though... take a look at

In particular, look at how

So, corresponding to a

Less work than going through

We can save the

**choices**, and I don't see an obvious way to generate them in what would correspond to ascending order. (Though that doesn't mean there isn't one.)One thing we can do, though... take a look at

**noTwos**, the source of by far the most of the d-digit Ys for all but the smallest d values.**noTwos n**

| n == 1 = [1,3]

| even n = base

| otherwise = concat [[p, p + tenToThe halfN] | p <- base]

where halfN = n `div` 2

base = justOnes n (min 3 (halfN - 1))| n == 1 = [1,3]

| even n = base

| otherwise = concat [[p, p + tenToThe halfN] | p <- base]

where halfN = n `div` 2

base = justOnes n (min 3 (halfN - 1))

In particular, look at how

**base**is calculated. Suppose**n == 2 * k**for some k. Then for**n**and**n + 1**,**halfN - 1**has the same value and thus**min 3 (halfN - 1)**has the same value. Sure,**n**is different, but that just means for**n + 1**there's a one digit gap left to either put a one in or leave at zero. Check it out.***Main> justOnes 2 0**

[11]

*Main> justOnes 3 0

[101]

*Main> justOnes 4 1

[1001,1111]

*Main> justOnes 5 1

[10001,11011]

*Main> justOnes 6 2

[100001,101101,110011,111111]

*Main> justOnes 7 2

[1000001,1010101,1100011,1110111][11]

*Main> justOnes 3 0

[101]

*Main> justOnes 4 1

[1001,1111]

*Main> justOnes 5 1

[10001,11011]

*Main> justOnes 6 2

[100001,101101,110011,111111]

*Main> justOnes 7 2

[1000001,1010101,1100011,1110111]

So, corresponding to a

**base**value**x**for**noTwos (2 * k)**, the corresponding value for**noTwos (2 * k + 1)**is**let (a, b) = x `divMod` (tenToThe k)****in a * tenToThe (k + 1) + b**Less work than going through

**justOnes**, I'd say... and it applies whether we figure out a clever way to generate the values in order or not. Note also that this mapping preserves numerical order, so if we do find a way to cleverly generate these values in order, taking advantage of this mapping won't mess that up.We can save the

**base**values for even numbers, though it would be nice if we could somehow notice when we do their successors and render them garbage collectable; otherwise that's 15,275**Integer**s hanging around in lists. Haskell has some memoization types and functions around that go beyond the simple lists as arrays we've been doing, but I'm not sure whether they support something like that.
## Comments