login
Rearrangement of natural numbers so that starting with a(n) the concatenation of n numbers is divisible by n. Choose the smallest number that has not already appeared if there is a choice.
4

%I #6 Sep 10 2017 05:21:19

%S 1,2,4,3,5,6,8,7,10,9,14,11,12,13,20,15,22,16,30,17,28,18,32,19,31,21,

%T 24,23,35,25,44,26,48,27,40,29,49,33,60,34,53,36,52,37,50,38,72,39,75,

%U 41,56,42,64,43,68,45,67,46,80,47,83,51,104,54,71,55,86,57,95,58,100,59

%N Rearrangement of natural numbers so that starting with a(n) the concatenation of n numbers is divisible by n. Choose the smallest number that has not already appeared if there is a choice.

%e 2 divides 24, 3 divides 435, 4 divides 3568, etc.

%p a:=proc(n) option remember; local t, S, i; S:={$1..300} minus {seq(a(i),i=1..n-1)}; t:=min(S[]); if n::odd then while parse(cat(seq(a((n+1)/2+i),i=0..(n-3)/2),t)) mod (n+1)/2 <> 0 do S:=S minus {t}; t:=min(S[]) od fi; t end: a(1):=1: seq(a(n),n=1..186); # Alec Mihailovs

%Y Cf. A075619, A083195.

%K base,nonn

%O 1,2

%A _Amarnath Murthy_, Sep 29 2002

%E More terms from Alec Mihailovs (alec(AT)mihailovs.com), Jul 05 2004