[seqfan] Re: Is there a better way to find the terms of this sequence (other than trial and error)? Correction

M. F. Hasler oeis at hasler.fr
Sun Nov 10 16:57:02 CET 2019


On Sun, Nov 10, 2019 at 2:54 AM Ali Sada wrote:

> a(n)=m+1, where m is the least multiple of n such that a(n) digits consist
> only of all the distinct digits of n+1 and n+2.
>

It depends what you call "better" and what you call "trial and error".
You can indeed write a program the avoids testing "all" multiples.
For example, if the first digit is not in the allowed set, you can skip
increasingly many multiples.

There are certainly "even more intelligent" (lol) approaches.
But most probably the programs get much longer. I think that testing
leading digits and skipping contiguous ranges where a given digit excludes
success will maybe a good length/efficiency compromise.

For example, 209 is the least multiple of 19 where m (209+1=210) consists
> only of the distinct digits of 20 and 21.

23, 43, 445,65, 76, 787, 988, 1009, 1111111111, 21, 1321, 11413, 4551, 561,
> 11176, 8817, 9181,1122229, 210, 221, 232, 243, 254, 265, 276, 287, 298,
> 22093, 1103, 3211, 32, 34433,3334


I get different values.
I notice that you say "only all the digits of n+1 and n+2",
but on one hand, 445 has twice the digit of 4, idem for 1009,
so I am not sure whether you really don't want to allow a(9) = 10 = 9+1
which has all and only digits of 10 and 11 -- or maybe that would be OK ?
Also, your a(18) does not contain the 0 of 20, several other following
values are smaller than yours:

apply(
{a(n,d=eval(Set(Vec(Str(n+1,n+2)))))=forstep(m=n,oo,n,Set(digits(m+1))==d&&return(m+1))},
[1..20])
% = [23, 43, 445, 65, 76, 787, 988, 1009, 10, 21, 1123, 11341, 1145, 561,
11176, 817, 9181, 10122229, 210, 21]

For a(9) and a(20), I'm not sure whether you mean "multiple of n larger
than n":
If so, "m=n" must be replaced by "m=2*n" in my code which then gives
a(9) = 100 = 9*11 + 1 (still much smaller than 11...11), and
a(20) = 121 = 20*6 + 1, having only and all digits of 21 and 22, but
also smaller than your 221.

- Maximilian



More information about the SeqFan mailing list