Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #15 Dec 18 2015 11:54:48
%S 3691,2,1,5,182,124,27303336394,245,4,8,515,457,606366697,275,7,88,
%T 184,879093969910,2105,10,811,11,14,1171,20,1231,26,1291,32,13,5138,
%U 1411,44,1471,50,1531,56,1591,62,16,5168,17,1174,1771,80,1831,86,1891,92,19,5198,20120,4207,2102,1321,62192,22
%N Consider the succession of single digits of A008585 (multiples of 3): 3 6 9 1 2 1 5 1 8 2 1 2 4 2 7 3 0 .... This sequence gives the lexicographically earliest derangement of A001651 (non-multiples of 3) that produces the same succession of digits.
%C Derangement here means a(n) != A008585(n) for all n.
%C Original name: "Write each non-multiple of 3 integer >0 on a single label. Put the labels in numerical order to form an infinite sequence L. Now consider the succession of single digits of A008585 (multiples of 3): 3,6,9,1,2,1,5,1,8,2,1,2,4,2,7,3,0,3,3,3,6,3,9,4,2,4,5,4,8,5,1,5,4,5,7,6,0... The sequence S gives a rearrangement of the labels that reproduces the same succession of digits, subject to the constraint that the smallest label must be used that does not lead to a contradiction."
%C This could be roughly rephrased like this: "Rewrite in the most economical way the 'multiples-of-3 pattern' using only non-multiples of 3. Do not use any non-multiple of 3 twice."
%H Michael De Vlieger, <a href="/A097500/b097500.txt">Table of n, a(n) for n = 1..10000</a>
%e We must begin with "3,6,9,12,..." and we cannot represent "3" with 3, 36, or 369, because they are all multiples of 3. So the first possibility for a(1) is 3691.
%t f[lst_List, k_] := Block[{L = lst, g, a = {}, m = 0}, g[] := {Set[m, First@ FromDigits@ Append[IntegerDigits@ m, First@ #]], Set[L, Last@ #]} &@ TakeDrop[L, 1]; Do[g[]; While[Or[Mod[m, 3] == 0, First@ L == 0, MemberQ[a, m]], g[]]; AppendTo[a, m]; m = 0, {k}]; a]; f[Flatten@ Map[IntegerDigits, Array[3 # &, {120}]], 57] (* _Michael De Vlieger_, Nov 30 2015, Version 10.2 *)
%Y Cf. A001651, A008585, A097488.
%K base,easy,nonn
%O 1,1
%A _Eric Angelini_, Sep 19 2004
%E Name, Comments, and Example edited by _Danny Rorabaugh_, Nov 28 2015
%E More terms from _Michael De Vlieger_, Nov 30 2015