Divisible by n-th digit

> a(n) is the smallest integer not yet present in S such that a(n) is divisible by the n-th digit of S (if you have to

> divide by zero, divide by 10 instead):

>

> S = 1,2,3,4,5,6,7,8,9,10,20,12,30,11,14,15,40,13,16,17,24,18,

> 25,28,50,19,21,22,36,23,35,26,32,27,48,34,45,38,56,55, 60,29,

> 54,42,31,44,46, ...

> Done by hand in a couple of minutes -- could someone please

> check and submit, if of interest?

>

> Example:

>                                                  a(n)th digit of S:

>(NYiS means "not yet in S")                                        |

> the smallest NYiS integer divisible by the 1st digit of S is 1    1

> the smallest NYiS integer divisible by the 2nd digit of S is 2    2

> the smallest NYiS integer divisible by the 3rd digit of S is 3    3

> the smallest NYiS integer divisible by the 4th digit of S is 4    4

> the smallest NYiS integer divisible by the 5th digit of S is 5    5

> the smallest NYiS integer divisible by the 6th digit of S is 6    6

> the smallest NYiS integer divisible by the 7th digit of S is 7    7

> the smallest NYiS integer divisible by the 8th digit of S is 8    8

> the smallest NYiS integer divisible by the 9th digit of S is 9    9

> the smallest NYiS integer divisible by the 10th digit of S is 10  1

> the smallest NYiS integer divisible by the 11th digit of S is 20  0

> (as the 11th digit of S is zero, a(n) must be divisible by 10)

> the smallest NYiS integer divisible by the 12th digit of S is 12  2

> the smallest NYiS integer divisible by the 13th digit of S is 30  0

> the smallest NYiS integer divisible by the 14th digit of S is 11  1

> the smallest NYiS integer divisible by the 15th digit of S is 14  2

> the smallest NYiS integer divisible by the 16th digit of S is 15  3

> the smallest NYiS integer divisible by the 17th digit of S is 40  0

> the smallest NYiS integer divisible by the 18th digit of S is 13  1

> the smallest NYiS integer divisible by the 19th digit of S is 16  1

> the smallest NYiS integer divisible by the 20th digit of S is 17  1

> the smallest NYiS integer divisible by the 21st digit of S is 24  4

> ...

> S is a permutation of the Natural numbers.

> Best,

> É.

Maximilian Hasler was quick to answer :

> My (ugly but short) PARI script,

{S=[u=0]; while(#S<99, for(a=1,9e9, bittest(u,a)&next; a>9 &

a%if(S,S,10) & next; print1(a","); u+=1<<a; a>10 &

S=concat(vecextract(S,"^1"),eval(Vec(Str( a ))));break))}

gives:

S = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 12, 30, 11, 14, 15, 40, 13, 16, 17, 24, 18, 25, 28, 50, 19, 21, 22, 36, 23, 35, 26, 32, 27, 48, 34, 45, 38, 56, 55, 60, 29, 54, 42, 31, 44, 46, 33, 66, 52, 39, 51, 65, 58, 72, 57, 62, 64, 49, 68, 80, 63, 76, 84, 70, 69, 88, 75, 78, 85, 90, 96, 100, 74, 81, 95, 92, 104, 82, 87, 37, 108, 112, 116, 102, 93, 99, 114, 120, 105, 86, 111, 117, 110, 41, 126, ...

I will submit it.

Regards,

Maximilian

__________

Merci, Maximilian !

É.

(En français : le premier terme de S est divisible par le premier chiffre de S ; le 2e terme de S est divisible par le 2e chiffre de S ; le 3e terme de S est divisible par le 3e chiffre de S ; etc. S’il faut diviser par 0, préférer diviser par 10. On prolongera toujours la séquence S par le plus petit terme non encore présent dans S et ne conduisant pas à une contradiction).