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-7 of 7 results.

A004760 List of numbers whose binary expansion does not begin 10.

Original entry on oeis.org

0, 1, 3, 6, 7, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122
Offset: 1

Views

Author

Keywords

Comments

For n >= 2 sequence {a(n+2)} is the minimal recursive such that A007814(a(n+2))=A007814(n). - Vladimir Shevelev, Apr 27 2009
A053645(a(n)) = n-1 for n > 0. - Reinhard Zumkeller, May 20 2009
a(n+1) is also the number of nodes in a complete binary tree with n nodes in the bottommost level. - Jacob Jona Fahlenkamp, Feb 01 2023

Crossrefs

Programs

  • Maple
    0,1,seq(seq(3*2^d+x,x=0..2^d-1),d=0..6); # Robert Israel, Aug 03 2016
  • Mathematica
    Select[Range@ 125, If[Length@ # < 2, #, Take[#, 2]] &@ IntegerDigits[#, 2] != {1, 0} &] (* Michael De Vlieger, Aug 02 2016 *)
  • PARI
    is(n)=n<2 || binary(n)[2] \\ Charles R Greathouse IV, Sep 23 2012
    
  • PARI
    print1("0, 1");for(i=0,5,for(n=3<Charles R Greathouse IV, Sep 23 2012
    
  • PARI
    a(n) = if(n<=2,n-1, (n-=2) + 2<Kevin Ryde, Jul 22 2022
    
  • Python
    def A004760(n): return m+(1<0 else n-1 # Chai Wah Wu, Jul 26 2023
  • R
    maxrow <- 8 # by choice
    b01 <- 1
    for(m in 0:maxrow){
      b01 <- c(b01,rep(1,2^(m+1))); b01[2^(m+1):(2^(m+1)+2^m-1)] <- 0
    }
    a <- which(b01 == 1)
    # Yosu Yurramendi, Mar 30 2017
    

Formula

For n > 0, a(n) = 3n - 2 - A006257(n-1). - Ralf Stephan, Sep 16 2003
a(0) = 0, a(1) = 1, for n > 0: a(2n) = 2*a(n) + 1, a(2n+1) = 2*a(n+1). - Philippe Deléham, Feb 29 2004
For n >= 3, A007814(a(n)) = A007814(n-2). - Vladimir Shevelev, Apr 15 2009
a(n+2) = min{m>a(n+1): A007814(m)=A007814(n)}; A010060(a(n+2)) = 1-A010060(n). - Vladimir Shevelev, Apr 27 2009
a(1)=0, a(2)=1, a(2^m+k+2) = 2^(m+1) + 2^m+k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Jul 30 2016
G.f.: x/(1-x)^2 + (x/(1-x))*Sum_{k>=0} 2^k*x^(2^k). - Robert Israel, Aug 03 2016
a(2^m+k) = A004761(2^m+k) + 2^m, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016
For n > 0, a(n+1) = n + 2^ceiling(log_2(n)) - 1. - Jacob Jona Fahlenkamp, Feb 01 2023

Extensions

Offset changed to 1, b-file corrected. - N. J. A. Sloane, Aug 07 2016

A159559 Lexicographically first strictly increasing sequence starting a(2) = 3 with the property that a(n) is prime if and only if n is prime.

Original entry on oeis.org

3, 5, 6, 7, 8, 11, 12, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 32, 33, 37, 38, 39, 40, 42, 44, 47, 48, 53, 54, 55, 56, 57, 58, 59, 60, 62, 63, 67, 68, 71, 72, 74, 75, 79, 80, 81, 82, 84, 85, 89, 90, 91, 92, 93, 94, 97, 98, 101, 102, 104, 105, 106, 108, 109, 110, 111
Offset: 2

Views

Author

Vladimir Shevelev, Apr 15 2009, May 04 2009

Keywords

Comments

a(n) is prime iff n is prime.

Examples

			For n = 6, since n is composite, a(6) is the smallest composite number greater than a(6-1) = a(5) = 7, so a(6) = 8. For n = 11, since n is prime, a(11) is the smallest prime number greater than a(11-1) = a(10) = 15, so a(12) = 17. - _Michael B. Porter_, Sep 04 2016
		

Crossrefs

Programs

  • Maple
    A159559 := proc(n) option remember; if n = 2 then 3; else for a from procname(n-1)+1 do if isprime(n) and isprime(a) then RETURN(a) ; elif not isprime(n) and not isprime(a) then RETURN(a) ; fi; od: fi; end: seq(A159559(n),n=2..100) ; # R. J. Mathar, Jul 28 2009
  • Mathematica
    a[2] = 3;
    a[n_] := a[n] = If[PrimeQ[n], NextPrime[a[n-1]], NestWhile[#+1&, a[n-1]+1, PrimeQ]];
    Map[a, Range[2, 100]] (* Peter J. C. Moses, Sep 19 2013 *)
  • PARI
    nextcomposite(n)=if(n<4, return(4)); n=ceil(n); if(isprime(n),n+1,n)
    first(n)=my(v=vector(n)); v[2]=3; for(k=3,n, v[k]=if(isprime(k),nextprime(v[k-1]+1), nextcomposite(v[k-1]+1))); v[2..n] \\ Charles R Greathouse IV, Sep 21 2016

Formula

a(n+1) = min{m>a(n), m is prime}, if n+1 is prime; otherwise, a(n+1) = min{m>a(n), m is composite}.

Extensions

More terms from R. J. Mathar, Jul 28 2009

A229019 Minimal position at which the sequence defined in the same way as A159559 but with initial term prime(n) merges with A159559; a(n)=0 if there is no such position.

Original entry on oeis.org

2, 11, 47, 47, 47, 683, 683, 683, 683, 683, 683, 683, 683, 683, 683, 683, 683, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 1117, 6257, 6257, 6257, 6257, 6257, 6257, 6257, 6257, 390703, 390703, 390703, 390703, 390703, 390703, 390703, 390703
Offset: 2

Views

Author

Vladimir Shevelev, Sep 11 2013

Keywords

Comments

All positive terms of the sequence are prime.
Conjecture: all terms are positive.

Examples

			For n>=2, denote by A_n the sequence defined in the same way as A159559 but with initial term A_n(2)=prime(n). In case n=2 A_2(2)=3, hence A_2 = A159559, and so a(2)=2. Suppose n=3. Then A_3(2)=5 and by the definition of A159559 we have A_3(3)=7, A_3(4)=8, A_3(5)=11, A_3(6)=12, A_3(7)=13, A_3(8)=14, A_3(9)=15, A_3(10)=16, A_3(11)=17. Since A159559(11) is also 17, then, beginning with 11, A_3 merges with A159559 and a(3)=11. - _Vladimir Shevelev_, Sep 11 2016.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, p) option remember; local m;
          if n=2 then p
        else for m from b(n-1,p)+1 while isprime(m) xor isprime(n)
             do od; m
          fi
        end:
    a:= proc(n) option remember; local k;
          for k from 2 while b(k, 3)<>b(k, ithprime(n)) do od; k
        end:
    seq(a(n), n=2..20);  # Alois P. Heinz, Sep 15 2013
  • Mathematica
    f[n_, r_] := Block[{a}, a[2] = n; a[x_] := a[x] = If[PrimeQ@ x, NextPrime@ a[x - 1], NestWhile[# + 1 &, a[x - 1] + 1, PrimeQ@ # &]]; Map[a, Range[2, r]]]; nn = 10^4; t = f[3, nn]; Table[1 + First@ Flatten@ Position[BitXor[t, f[Prime@ n, nn]], 0], {n, 2, 37}] (* Michael De Vlieger, Sep 13 2016, after Peter J. C. Moses at A159559 *)

Extensions

More terms from Alois P. Heinz, Sep 15 2013

A004759 Binary expansion starts 111.

Original entry on oeis.org

7, 14, 15, 28, 29, 30, 31, 56, 57, 58, 59, 60, 61, 62, 63, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244
Offset: 1

Views

Author

Keywords

Comments

This is the minimal recursive sequence such that a(1)=7, A007814(a(n))= A007814(n) and A010060(a(n))=A010060(n). - Vladimir Shevelev, Apr 23 2009

Examples

			30 in binary is 11110, so 30 is in sequence.
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a004759 n = a004759_list !! (n-1)
    a004759_list = 7 : concat (transpose [zs, map (+ 1) zs])
                       where zs = map (* 2) a004759_list
    -- Reinhard Zumkeller, Dec 03 2015
    
  • Mathematica
    w = {1, 1, 1}; Select[Range[5, 244], If[# < 2^(Length@ w - 1), True, Take[IntegerDigits[#, 2], Length@ w] == w] &] (* Michael De Vlieger, Aug 10 2016 *)
    Sort[FromDigits[#,2]&/@(Flatten[Table[Join[{1,1,1},#]&/@Tuples[{1,0},n],{n,0,5}],1])] (* Harvey P. Dale, Sep 01 2016 *)
  • PARI
    a(n)=n+6*2^floor(log(n)/log(2))
    
  • Python
    def A004759(n): return n+(3<Chai Wah Wu, Jul 13 2022

Formula

a(2n) = 2a(n), a(2n+1) = 2a(n) + 1 + 6[n==0].
a(n) = n + 6 * 2^floor(log_2(n)) = A004758(n) + A053644(n).
a(n+1) = min{m > a(n): A007814(m) = A007814(n+1) and A010060(m) = A010060(n+1)}. a(2^k) - a(2^k-1) = A103204(k+2), k >= 1. - Vladimir Shevelev, Apr 23 2009
a(2^m+k) = 7*2^m + k, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Aug 08 2016

Extensions

Edited by Ralf Stephan, Oct 12 2003

A172980 a(1)=1, a(2)=3; for n>=3, a(n) is the smallest number larger than a(n-1) such that, for every k

Original entry on oeis.org

1, 3, 4, 9, 11, 12, 13, 15, 16, 33, 37, 42, 43, 117, 154, 159, 163, 168, 173, 231, 338, 555, 557, 558, 649, 1161, 1168, 1209, 1213, 1254, 1259, 1263, 1406, 1467, 1573, 1578, 1579, 2595, 2752, 2805, 2813, 2964, 2969, 2997, 3014, 5013, 5021, 5022, 5057, 5115
Offset: 1

Views

Author

Vladimir Shevelev, Nov 21 2010

Keywords

Comments

Using the Chinese remainder theorem, it is easy to prove that the sequence is infinite.

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
         local ok, m, k;
         if n<3 then 2*n-1
       else for m from a(n-1)+1 do
              ok:= true;
              for k from 1 to n-1 do
                if igcd(n, k)=1 xor igcd(m, a(k))=1
                   then ok:= false; break fi
              od;
              if ok then break fi
            od; m
         fi
        end:
    seq (a(n), n=1..50);  # Alois P. Heinz, Nov 21 2010
  • Mathematica
    a[1]=1; a[2]=3; a[n_] := a[n] = For[k = a[n-1]+1, True, k++, If[AllTrue[ Range[n-1], CoprimeQ[k, a[#]] == CoprimeQ[n, #]&], Return[k]]]; Table[ a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 25 2017 *)

Extensions

More terms from Alois P. Heinz, Nov 21 2010

A172999 a(1)=1, a(2)=4; for n>=3, a(n) is the smallest number larger than a(n-1) such that, for every k

Original entry on oeis.org

1, 4, 5, 6, 7, 10, 11, 12, 25, 28, 29, 30, 31, 44, 175, 178, 179, 180, 181, 182, 275, 348, 349, 360, 371, 372, 395, 396, 397, 420, 421, 422, 725, 1074, 1309, 1310, 1319, 1448, 2945, 2954, 2957, 2970, 2971, 3016, 3325, 4188, 4189, 4190, 4213, 4214, 4475, 4526
Offset: 1

Views

Author

Vladimir Shevelev, Nov 21 2010

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
         local ok, m, k;
         if n<3 then 3*n-2
       else for m from a(n-1)+1 do
              ok:= true;
              for k from 1 to n-1 do
                if igcd(n, k)=1 xor igcd(m, a(k))=1
                   then ok:= false; break fi
              od;
              if ok then break fi
            od; m
         fi
        end:
    seq (a(n), n=1..50);  # Alois P. Heinz, Nov 21 2010
  • Mathematica
    t={1,4}; Do[nxt=t[[-1]]+1; While[CoprimeQ[n,Range[n-1]] != CoprimeQ[nxt,t], nxt++]; AppendTo[t,nxt], {n,3,50}]; t

Extensions

More terms from Alois P. Heinz, Nov 21 2010

A229132 Initials for A159559 corresponding to records of A229019.

Original entry on oeis.org

3, 5, 7, 17, 67, 113, 163
Offset: 1

Views

Author

Vladimir Shevelev, Sep 15 2013

Keywords

Comments

Records of A229019 are 2, 11, 47, 683, 1117, 6257, 390703.

Examples

			If to take as the initial for A159559 a(4)=17, then we obtain a sequence which merges with A159559 for n equals the fourth record of A229019, that is, n=683.
		

Crossrefs

Showing 1-7 of 7 results.