A299974 Lexicographic first sequence of positive integers such that a(n) + a(n+1) has a digit 4, and no term occurs twice.
1, 3, 11, 13, 21, 19, 5, 9, 15, 25, 16, 8, 6, 18, 22, 2, 12, 28, 14, 10, 4, 20, 23, 17, 7, 27, 37, 47, 57, 67, 73, 31, 33, 41, 43, 51, 53, 61, 63, 71, 69, 35, 29, 45, 39, 55, 49, 65, 59, 75, 66, 38, 26, 48, 36, 58, 46, 68, 56, 78, 62, 32, 42, 52, 72, 70, 24, 30, 34, 40, 44, 50, 54, 60, 64, 76, 88, 86, 98, 96, 108, 106, 118, 116, 124, 80, 74, 90, 84
Offset: 1
Crossrefs
Programs
-
PARI
a(n,f=1,d=4,a=1,u=[a])={for(n=2,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}
Comments