cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A303657 a(n) is the least positive integer not yet in the sequence which shares a digit with a(n-2); a(1)=0, a(2)=1.

Original entry on oeis.org

0, 1, 10, 11, 12, 13, 2, 3, 20, 23, 21, 22, 14, 24, 4, 25, 34, 5, 30, 15, 31, 16, 17, 6, 7, 26, 27, 28, 29, 8, 9, 18, 19, 38, 39, 32, 33, 35, 36, 37, 43, 47, 40, 41, 42, 44, 45, 46, 48, 49, 54, 59, 50, 51, 52, 53, 55, 56, 57, 58, 65, 68, 60, 61, 62, 63, 64, 66
Offset: 1

Views

Author

Enrique Navarrete, Apr 27 2018

Keywords

Comments

Up to n=34 the first differences of the sequence are bounded by -29 and 25; the bounds are -10 and 10 thereafter.
From a(103)=100 onwards, the sequence has slope = 1 with minor jumps about every 100 terms.
It appears that this sequence has an inverse, namely 1, 2, 7, 8, 15, 18, 24, 25, 30, 31, 3, 4, 5, 6, 13, 20, 22, 23, 32, 33, 9, ..., . - Robert G. Wilson v, Apr 29 2018 [Edited by Rémy Sigrist, May 06 2018]

Examples

			a(7)=2 since it is the least positive integer not yet in the sequence which shares a digit with a(5)=12.
		

Crossrefs

Programs

  • Mathematica
    f[s_List] := Block[{k = 2, l = Union@ IntegerDigits@ s[[-2]]}, While[MemberQ[s, k] || Intersection[l, IntegerDigits@ k] == {}, k++]; Append[s, k]]; Nest[f, {0, 1}, 70] (* Robert G. Wilson v, Apr 29 2018 *)
  • PARI
    Digits(x,b)=if(!x,[0],digits(x,b));
    firstTerms(n,{k=2},{b=10})={my(N=b*n);my(s=List(vector(N,u,u-1)),t,x,y);for(m=k+1,n,x=Set(Digits(s[m-k],b));for(i=m,N,y=Set(Digits(s[i],b));if(#setintersect(x,y),t=s[i];listpop(s,i);listinsert(s,t,m);break)));return(Vec(s)[1..n])}
    a(n)=firstTerms(n)[n]; \\ R. J. Cano, May 05 2018
    
  • PARI
    See Cano link.

A304237 a(n) is the smallest positive integer not yet in the sequence that is obtained when the first and last digits of a(n-1) are exchanged and used in a(n) in the exchanged order (but not necessarily adjacent); a(1)=10.

Original entry on oeis.org

10, 101, 11, 110, 201, 12, 21, 102, 121, 111, 112, 210, 202, 22, 122, 211, 120, 301, 13, 31, 103, 131, 113, 231, 123, 310, 203, 32, 23, 132, 212, 220, 302, 213, 232, 221, 124, 41, 14, 141, 114, 241, 125, 51, 15, 151, 115, 251, 126, 61, 16, 161, 116, 261, 127, 71, 17, 171, 117, 271, 128, 81, 18, 181, 118
Offset: 1

Views

Author

Enrique Navarrete, May 08 2018

Keywords

Comments

Up to n=82, the only consecutive numbers in the sequence are 111, 112 and 222, 223.
Could have started sequence with offset a(0)=0 and it would be the same sequence.

Examples

			a(2)=101 since 101 is the smallest positive number not yet in the sequence that is obtained when the first and last digits of a(1)=10 are exchanged and used in that order.
a(8)=102 since 102 is the smallest positive number not yet in the sequence that is obtained when the first and last digits of a(7)=21 are exchanged and used in that order (but not necessarily adjacent).
		

Crossrefs

Programs

  • PARI
    firstTerms(n)={my(Seq=vector(n),a=[1,0],c,y,k,h=Vecsmall(0,1000*n));print1("10,");Seq[1]=10;h[11]=1;for(i=2,n,for(t=11,oo,if(!h[t+1],c=digits(t);y=1;while((y<#c)&&(!c[y]),y++);forvec(u=[[y,#c],[y,#c]],if(k=([c[u[1]],c[u[2]]]==[a[#a],a[1]]),break),2);if(k,Seq[i]=t;print1(t",");a=c;h[t+1]=1;break))));return(Seq)} \\ R. J. Cano, May 11 2018

A323708 a(n) is the smallest positive number not yet in the sequence that contains both the smallest and largest digits from a(n-1); a(1)=1.

Original entry on oeis.org

1, 10, 100, 101, 102, 20, 120, 200, 201, 202, 203, 30, 103, 130, 230, 300, 301, 302, 303, 304, 40, 104, 140, 204, 240, 340, 400, 401, 402, 403, 404, 405, 50, 105, 150, 205, 250, 305, 350, 450, 500, 501, 502, 503, 504, 505, 506, 60, 106, 160, 206, 260, 306, 360
Offset: 1

Views

Author

Enrique Navarrete, Jan 24 2019

Keywords

Comments

All terms starting with a(2)=10 must contain the digit 0.
From a(110)=809 onwards all terms must contain the digits 0 and 9.
Note that A011540 can also be defined as the sequence where a(n) is the smallest number not yet in the sequence that contains the smallest digit from a(n-1). See crossrefs.

Examples

			a(2)=10 since 10 is the smallest positive number not yet in the sequence that contains the smallest and largest digit (i.e., 1) from a(1)=1.
a(6)=20 since 20 is the smallest positive number not yet in the sequence that contains the smallest and largest digits from a(5)=102.
		

Crossrefs

Cf. A107353, A011540 (smallest digit only), A286890 (largest digit only), A303605.

Programs

  • Maple
    N:= 1000: # for terms before the first term > N
    A[1]:= 1:
    S:= [$2..N]:
    dmin:= 1: dmax:= 1:
    found:= true:
    for n from 2 while found do
        found := false;
        for i from 1 to nops(S) do
          L:= convert(convert(S[i],base,10),set);
          if {dmin,dmax} subset L then
             A[n]:= S[i];
             dmax:= max(L);
             dmin:= min(L);
             found:= true;
             S:= subsop(i=NULL, S);
             break
          fi
        od;
    od:
    convert(A,list); # Robert Israel, Mar 28 2019
  • Mathematica
    Nest[Append[#, Block[{k = 2, d}, While[Nand[FreeQ[#[[All, 1]], k], SubsetQ[Set[d, IntegerDigits[k]], #[[-1, -1]] ]], k++]; {k, {Min@ d, Max@ d}}]] &, {{1, {1, 1}}}, 53][[All, 1]] (* Michael De Vlieger, Jan 27 2019 *)
  • PARI
    getFirstTerms(n)={my(Z=List(),A=List([1]),dd=[0,1],c,m=1);for(k=2,+oo,forvec(y=vector(k,u,[u==1,9]),listput(Z,y);for(i=1,#Z,if(m==n,return(Vec(A)));c=2;for(q=1,2,for(j=1,#Z[i],if(Z[i][j]==dd[q],c--;break)));if(!c,dd[1]=vecmin(Z[i]);dd[2]=vecmax(Z[i]);listput(A,fromdigits(Z[i]));listpop(Z,i);m++;break)),0))} \\ R. J. Cano, Feb 04 2019
    
  • PARI
    isok(k, vas, dm, dM) = {if (vecsearch(vas, k), return (0)); my(dk = Set(digits(k))); vecsearch(dk, dm) && vecsearch(dk, dM);}
    nexta(va, vas, i) = {my(k=1, d=digits(va[i]), dm = vecmin(d), dM = vecmax(d)); while (!isok(k, vas, dm, dM), k++); k;}
    lista(nn) = {my(va = vector(nn)); va[1] = 1; my(vas = vecsort(va,,8)); for (n=2, nn, va[n] = nexta(va, vas, n-1); vas = vecsort(va,,8);); va;} \\ Michel Marcus, Feb 05 2019
Showing 1-3 of 3 results.