%I #11 Nov 05 2016 08:43:44
%S 1,2,4,8,16,5,10,9,18,7,14,3,6,12,11,22,20,40,36,30,27,25,23,21,19,28,
%T 26,24,46,42,38,35,32,29,31,34,37,44,48,52,47,43,39,72,45,41,55,50,
%U 100,89,80,88,96,87,79,70,63,57,62,56,51,66,60,54,49,53,58,113,82,74,67,61,77,84,76,69,75,68,134,90,81
%N Each digit of the absolute difference |a(n+1)-a(n)| is also a digit of a(n): lexicographic first such sequence with no repeated term.
%C This sequence is a permutation of the positive integers, in contrast to the variant A277858, which was the inspiration for this sequence but which is defined using the much stronger constraint "|a(n+1)-a(n)| is a substring of a(n)".
%o (PARI) u=[a=1];for(n=1,99,print1(a","); u=setunion(u,[a]); while(#u>2&&u[2]==u[1]+1,u=u[^1]); d=Set(digits(a)); for(k=u[1]+1,9e9,!setsearch(u,k)&&!#setminus(Set(digits(abs(a-k))),d) &&(a=k)&&break))
%Y Cf. A277858.
%K nonn,base
%O 1,2
%A _M. F. Hasler_, Nov 04 2016
|