login
Lexicographic first sequence of nonnegative integers such that a(n) + a(n+1) has a digit 7, and no term occurs twice.
2

%I #6 Feb 23 2018 09:49:22

%S 0,7,10,17,20,27,30,37,33,4,3,14,13,24,23,34,36,1,6,11,16,21,26,31,39,

%T 8,9,18,19,28,29,38,32,5,2,15,12,25,22,35,40,47,50,57,60,67,70,77,80,

%U 87,83,44,43,54,53,64,63,74,73,84,86,41,46,51,56,61,66,71,76,81,89,48,49,58,59,68,69,78,79,88,82,45,42,55,52,65,62,75,72,85,90

%N Lexicographic first sequence of nonnegative integers such that a(n) + a(n+1) has a digit 7, and no term occurs twice.

%C A permutation of the nonnegative integers.

%o (PARI) a(n,f=1,d=7,a=0,u=[a])={for(n=1,n,f&&if(f==1,print1(a","),write(f,n-1," "a));for(k=u[1]+1,oo,setsearch(u,k)&&next;setsearch(Set(digits(a+k)),d)&&(a=k)&&break);u=setunion(u,[a]);u[2]==u[1]+1&&u=u[^1]);a}

%Y Cf. A299977 (analog with positive terms), A299957 (analog with digit 1), A299970, A299982..A299988, A299969 (digit 0, 2..8, 9).

%K nonn,base

%O 0,2

%A _M. F. Hasler_ and _Eric Angelini_, Feb 22 2018