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.

Previous Showing 21-30 of 36 results. Next

A072939 Define a sequence c depending on n as follows: c(1)=1 and c(2)=n; c(k+2) = (c(k+1) + c(k))/2 if c(k+1) and c(k) have the same parity; otherwise c(k+2) = abs(c(k+1) - 2*c(k)); sequence gives values of n such that lim_{k->oo} c(k) = infinity.

Original entry on oeis.org

3, 7, 9, 11, 15, 19, 23, 25, 27, 31, 33, 35, 39, 41, 43, 47, 51, 55, 57, 59, 63, 67, 71, 73, 75, 79, 83, 87, 89, 91, 95, 97, 99, 103, 105, 107, 111, 115, 119, 121, 123, 127, 129, 131, 135, 137, 139, 143, 147, 151, 153, 155, 159, 161, 163, 167, 169, 171, 175, 179
Offset: 1

Views

Author

Benoit Cloitre, Aug 12 2002

Keywords

Comments

If c(2) is even then c(k) = 1 for k >= 2*c(2), hence there is no even value in the sequence. If n is in the sequence, there exist an integer k(n) and an integer m(n) such that, for any k >= k(n), c(2k) - c(2k-1) = 2*m(n) and c(2k+1) - c(2k) = -m(n). Sometimes m(n) = (n-1)/2 but not always. If B(n) = a(n+1) - a(n) then B(n) = 2 or 4, but B(n) does not seem to follow any pattern.
Conjecture: a(n) = A036554(n)+1. - Vladeta Jovovic, Apr 01 2003
a(n) = A036554(n)+1 = A079523(n)+2. - Ralf Stephan, Jun 09 2003
Conjecture: this sequence gives the positions of 0's in the limiting 0-word of the morphism 0->11, 1->10, A285384. - Clark Kimberling, Apr 26 2017
Conjecture: This also gives the positions of the 1's in A328979. - N. J. A. Sloane, Nov 05 2019

Examples

			41 is in the sequence: if c(2)=41, then it follows that c(3)=21, c(4)=31, c(5)=26, c(6)=36, c(7)=31, c(8)=41, c(9)=36, ...; for k >= 2, c(2k) - c(2k-1) = 10 and c(2k+1) - c(2k) = -5, which implies that c(k) -> infinity.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A072939_gen(startvalue=2): return filter(lambda n:(~(n-1)&(n-2)).bit_length()&1,count(max(startvalue,2))) # generator of terms >= startvalue
    A072939_list = list(islice(A072939_gen(),30)) # Chai Wah Wu, Jul 05 2022
    
  • Python
    def A072939(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c, s = n+x, bin(x)[2:]
            l = len(s)
            for i in range(l&1,l,2):
                c -= int(s[i])+int('0'+s[:i],2)
            return c
        return bisection(f,n,n)+1 # Chai Wah Wu, Jan 29 2025

Formula

Conjecture: lim_{n->oo} a(n)/n = 3.

A161673 Positions n such that A010060(n) + A010060(n+8) = 1.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 48, 49, 50, 51, 52, 53, 54, 55, 64, 65, 66, 67, 68, 69, 70, 71, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103
Offset: 1

Views

Author

Vladimir Shevelev, Jun 16 2009

Keywords

Comments

Also union of numbers of the form 8*A121539(n)+k, 0<=k<8.
Generalization: the numbers n such that A010060(n)+A010060(n+2^m)=1 constitute the union of sequences {2^m*A121539(n)+k}, k=0,1,...,2^m-1.

Crossrefs

Programs

  • Mathematica
    tm[0] = 0; tm[n_?EvenQ] := tm[n] = tm[n/2]; tm[n_] := tm[n] = 1 - tm[(n - 1)/2]; Reap[For[n = 0, n <= 6000, n++, If[tm[n] + tm[n + 8] == 1, Sow[n]]]][[2, 1]] (* G. C. Greubel, Jan 05 2018 *)
  • PARI
    is(n)=hammingweight(n)%2!=hammingweight(n+8)%2 \\ Charles R Greathouse IV, Aug 20 2013

Formula

Extensions

Edited and extended by R. J. Mathar, Sep 02 2009

A161817 Positions n such that A010060(n) = A010060(n+5).

Original entry on oeis.org

0, 2, 5, 8, 10, 11, 12, 14, 15, 16, 18, 21, 24, 26, 29, 32, 34, 37, 40, 42, 43, 44, 46, 47, 48, 50, 53, 56, 58, 59, 60, 62, 63, 64, 66, 69, 72, 74, 75, 76, 78, 79, 80, 82, 85, 88, 90, 93, 96, 98, 101, 104, 106, 107, 108, 110, 111, 112, 114, 117, 120, 122, 125, 128, 130, 133, 136, 138, 139, 140, 142, 143, 144
Offset: 1

Views

Author

Vladimir Shevelev, Jun 20 2009

Keywords

Comments

Let A=Axxxxxx be any sequence. Denote by A^* the intersection of A and the union of sequences {4*A(n)+k}, k=-1,0,1,2. Then the present sequence is the union of A079523^* and A121539^*.
Conjecture. In every sequence of numbers n such that A010060(n)=A010060(n+k) for fixed odd k, the odious (A000069) and evil (A001969) terms alternate. [Vladimir Shevelev, Jul 31 2009]

Crossrefs

Programs

  • Mathematica
    tm[0] = 0; tm[n_?EvenQ] := tm[n] = tm[n/2]; tm[n_] := tm[n] = 1 - tm[(n - 1)/2]; Reap[For[n = 0, n <= 20000, n++,  If[tm[n] == tm[n + 5], Sow[n]]]][[2, 1]] (* G. C. Greubel, Jan 05 2018 *)
  • PARI
    is(n)=hammingweight(n+5)==Mod(hammingweight(n),2) \\ Charles R Greathouse IV, Mar 26 2013

A161824 Numbers such that A010060(n) = A010060(n+6).

Original entry on oeis.org

0, 1, 2, 3, 6, 7, 8, 9, 12, 13, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 38, 39, 40, 41, 44, 45, 48, 49, 50, 51, 54, 55, 56, 57, 60, 61, 64, 65, 66, 67, 70, 71, 72, 73, 76, 77, 80, 81, 82, 83, 86, 87, 88, 89, 90, 91, 94, 95, 96, 97, 98, 99, 102, 103, 104, 105, 108
Offset: 1

Views

Author

Vladimir Shevelev, Jun 20 2009

Keywords

Comments

Let A=Axxxxxx be any sequence from OEIS. Denote by A^* the intersection of the union of sequences {2*A(n)+j}, j=0,1, and the union of sequences {4*A(n)+k}, k=-2,-1,0,1. Then the sequence is the union of (A079523)^* and (A121539)^*.

Crossrefs

Programs

  • Mathematica
    tm[0] = 0; tm[n_?EvenQ] := tm[n] = tm[n/2]; tm[n_] := tm[n] = 1 - tm[(n - 1)/2]; Reap[For[n = 0, n <= 6000, n++, If[tm[n] == tm[n + 6], Sow[n]]]][[2, 1]] (* G. C. Greubel, Jan 05 2018 *)
  • PARI
    is(n)=hammingweight(n)%2==hammingweight(n+6)%2 \\ Charles R Greathouse IV, Aug 20 2013

Extensions

Terms a(40) onwards added by G. C. Greubel, Jan 05 2018
Offset corrected by Mohammed Yaseen, Mar 29 2023

A161890 Numbers such that A010060(n) = A010060(n+9).

Original entry on oeis.org

0, 2, 3, 4, 6, 7, 9, 13, 15, 16, 18, 19, 20, 22, 24, 26, 27, 28, 30, 32, 34, 35, 36, 38, 39, 41, 45, 47, 48, 50, 51, 52, 54, 55, 57, 61, 63, 64, 66, 67, 68, 70, 71, 73, 77, 79, 80, 82, 83, 84, 86, 88, 90, 91, 92, 94, 96, 98, 99, 100, 102, 103, 105, 109, 111, 112, 114, 115, 116, 118, 120
Offset: 0

Views

Author

Vladimir Shevelev, Jun 21 2009

Keywords

Comments

Or union of intersection of A161639 and {A079523(n)-8} and intersection of A161673 and {A121539(n)-8}. In general, for a>=1, consider equations A010060(x+a)+A010060(x)=1, A010060(x+a)=A010060(x). Denote via B_a (C_a) the sequence of nonnegative solutions of the first (second) equation. Then we have recursions: B_(a+1) is the union of transactions 1) C_a and {A121539(n)-a}, 2) B_a and {A079523(n)-a}; C_(a+1) is the union of transactions 1) C_a and {A079523(n)-a}, 2) B_a and {A121539(n)-a}.
Conjecture. In every sequence of numbers n, such that A010060(n)=A010060(n+k), for fixed odd k, the odious (A000069) and evil (A001969) terms alternate. - Vladimir Shevelev, Jul 31 2009
This conjecture was actually proved in a later version of the Shevelev arxiv article cited below, and it can also easily be proved by the Walnut prover. - Jeffrey Shallit, Oct 12 2022

Crossrefs

Programs

  • Mathematica
    tm[0] = 0; tm[n_?EvenQ] := tm[n] = tm[n/2]; tm[n_] := tm[n] = 1 - tm[(n - 1)/2]; Reap[For[n = 0, n <= 18000, n++, If[tm[n] == tm[n + 9], Sow[n]]]][[2, 1]] (* G. C. Greubel, Jan 05 2018 *)
    SequencePosition[ThueMorse[Range[0,150]],{x_,,,_,,,_,,,x_}][[All,1]]-1 (* Harvey P. Dale, Feb 06 2023 *)
  • PARI
    is(n)=hammingweight(n)%2==hammingweight(n+9)%2 \\ Charles R Greathouse IV, Aug 20 2013

Extensions

Terms a(35) onward added by G. C. Greubel, Jan 05 2018

A091297 A fixed point of the morphism 0 -> 02, 1 -> 02, 2 -> 11, starting from 0.

Original entry on oeis.org

0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0, 2, 1, 1, 0, 2, 0, 2, 0
Offset: 1

Views

Author

Philippe Deléham, Feb 24 2004

Keywords

Comments

To construct the sequence: start from the Feigenbaum sequence A035263 = 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, ..., then change 1 -> 0, 2 and 0 -> 1, 1. - Philippe Deléham, Apr 18 2004
This Feigenbaum interpretation is equivalent to writing n+1 = binary "...1 00..00 x" where x is the least significant bit and zero or more 0's. If an odd number of 0's then a(n) = 1, otherwise a(n) = 2*x. In a similar way, if n-1 = binary "...0 11..11 x" with an odd number of 1's then a(n)=1 and otherwise a(n) = 2*x. - Kevin Ryde, Oct 17 2020
From Mikhail Kurkov, Mar 25 2021: (Start)
This sequence can be represented as a binary tree. Each child to the right is obtained by applying mex to the parent, and each child to the left is obtained by applying mex to the set formed by the parent and its second child:
( )
|
...................0...................
2 1
1......../ \........0 2......../ \........0
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
2 0 2 1 1 0 2 1
1 0 2 1 1 0 2 0 2 0 2 1 1 0 2 0
etc.
Here mex means smallest nonnegative missing number.
Each parent and its two children form a set {0,1,2}. (End)

Crossrefs

Programs

  • Mathematica
    Nest[ Function[ l, {Flatten[(l /. {0 -> {0, 2}, 1 -> {0, 2}, 2 -> {1, 1}}) ]}], {0}, 7] (* Robert G. Wilson v, Mar 03 2005 *)
  • PARI
    a(n)={while(1, my(m=logint(n,2)); if(n==2*2^m-1, return(m%2)); if(n==2^m, return(1 + m%2)); n-=2^m)} \\ Andrew Howroyd, Oct 17 2020
    
  • PARI
    a(n) = n++; my(k=valuation(n>>1,2)); if(k%2==1, 1, 2*(n%2)); \\ Kevin Ryde, Oct 17 2020

Formula

a(n) = 0 iff n = A079523(k), a(n) = 1 iff n = A081706(2*k) or n = 1 + A081706(2*k), a(n) = 2 iff n = A036554(k).
a(2*n-1) + a(2*n) = 2.
a(2*n-1) = (A065037(2*n+1) - A065037(2*n-1) - 2)/2.
From Mikhail Kurkov, Oct 10 2020: (Start)
a(2^m-1) = 1 - m mod 2, m > 0,
a(2^m) = 1 + m mod 2, m > 0,
a(2^m+k) = a(k) for 0 < k < 2^m-1, m > 1.
a(2^m-k) = 2 - a(k-1) for 1 < k <= 2^(m-1), m > 1. (End)
a(2n+1) = mex{a(n)}, a(2n) = mex{a(n),a(2n+1)} or a(2n+1) = [a(n)=0], a(2n) = 2 - [a(n)=2] for n > 0 with a(1) = 0. - Mikhail Kurkov, Mar 25 2021

Extensions

More terms from Robert G. Wilson v, Mar 03 2005

A095282 Primes whose binary-expansion ends with an even number of 1's.

Original entry on oeis.org

2, 3, 11, 19, 43, 47, 59, 67, 79, 83, 107, 131, 139, 163, 179, 191, 211, 227, 239, 251, 271, 283, 307, 331, 347, 367, 379, 419, 431, 443, 463, 467, 491, 499, 523, 547, 563, 571, 587, 619, 643, 659, 683, 691, 719, 739, 751, 787, 811, 827, 859
Offset: 1

Views

Author

Antti Karttunen, Jun 04 2004

Keywords

Crossrefs

Intersection of A000040 & (complement of A079523). Complement of A095283 in A000040. Cf. A027699, A095292.

Programs

  • Maple
    q:= proc(n) local i, l, r; l, r:= convert(n, base, 2), 0;
          for i to nops(l) while l[i]=1 do r:=r+1 od; is(r, even)
        end:
    select(q, [ithprime(i)$i=1..200])[];  # Alois P. Heinz, Dec 15 2019
  • Mathematica
    been1Q[n_]:=Module[{c=Split[IntegerDigits[n,2]][[-1]]},c[[1]]==1&&EvenQ[ Length[ c]]]; Join[{2},Select[Prime[Range[150]],been1Q]] (* Harvey P. Dale, Dec 14 2019 *)
  • PARI
    is(n)=valuation(n+1,2)%2==0 && isprime(n) \\ Charles R Greathouse IV, Oct 09 2013

A095283 Primes whose binary-expansion ends with an odd number of 1's.

Original entry on oeis.org

5, 7, 13, 17, 23, 29, 31, 37, 41, 53, 61, 71, 73, 89, 97, 101, 103, 109, 113, 127, 137, 149, 151, 157, 167, 173, 181, 193, 197, 199, 223, 229, 233, 241, 257, 263, 269, 277, 281, 293, 311, 313, 317, 337, 349, 353, 359, 373, 383, 389, 397, 401, 409
Offset: 1

Views

Author

Antti Karttunen, Jun 04 2004

Keywords

Crossrefs

Intersection of A000040 & A079523. Complement of A095282 in A000040. Cf. A027697, A095293.

Programs

  • Maple
    q:= proc(n) local i, l, r; l, r:= convert(n, base, 2), 0;
          for i to nops(l) while l[i]=1 do r:=r+1 od; is(r, odd)
        end:
    select(q, [ithprime(i)$i=1..150])[];  # Alois P. Heinz, Dec 15 2019
  • Mathematica
    Select[Prime[Range[100]], MatchQ[IntegerDigits[#, 2], {b:(1)..}|{_, 0, b:(1)..} /; OddQ[Length[{b}]]]&] (* Jean-François Alcover, Jan 03 2022 *)
  • PARI
    is(n)=valuation(n+1,2)%2 && isprime(n) \\ Charles R Greathouse IV, Oct 09 2013
    
  • Python
    from sympy import isprime
    def ok(n): b = bin(n); return (len(b)-len(b.rstrip("1")))%2 and isprime(n)
    print([k for k in range(1, 401) if ok(k)]) # Michael S. Branicky, Jan 03 2022

A161916 The smallest k such that A010060(n+k)=A010060(n).

Original entry on oeis.org

3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1, 2, 2, 3, 1, 3, 1, 3, 1
Offset: 0

Views

Author

Vladimir Shevelev, Jun 22 2009

Keywords

Comments

Each entry is 1, 2 or 3, associated with positions registered in A079523, A081706, and A161579, respectively.

Crossrefs

Extensions

Definition shortened, sequence extended by R. J. Mathar, Nov 02 2010

A225822 Lesser of adjacent odd numbers with different parity of binary weight and both isolated from odd numbers of same parity of binary weight.

Original entry on oeis.org

7, 23, 31, 39, 55, 71, 87, 95, 103, 119, 127, 135, 151, 159, 167, 183, 199, 215, 223, 231, 247, 263, 279, 287, 295, 311, 327, 343, 351, 359, 375, 383, 391, 407, 415, 423, 439, 455, 471, 479, 487, 503, 511, 519, 535, 543, 551, 567, 583, 599, 607, 615, 631
Offset: 1

Views

Author

Brad Clardy, Jul 30 2013

Keywords

Comments

Write the sequence of odious odd numbers above the sequence of evil odd numbers connecting all that are 2 apart:
1 7 11-13 19-21 25 31 35-37 41 47-49 55 59-61 67-69 73 79-81 87 91-93 97
3-5 9 15-17 23 27-29 33 39 43-45 51-53 57 63-65 71 75-77 83-85 89 95 99-
Remove the connected numbers:
1 7 25 31 41 55 73 87 97
9 23 33 39 57 71 89 95
Define these as "isolated".
The sequence is the smaller of the remaining pairs that are 2 apart.
The 1 is not a member since there is no change in parity between 1 and 7.
All of the differences between adjacent numbers in both the evil and odious sequences are either 2, 4 or 6, with 4 being the indicator that a transition in parity occurs. The program provided utilizes that fact to produce the sequence.
The sequence that includes all numbers along this path is A047522 (numbers congruent to {1,7} mod 8). This is also the same as the odd terms of A199398 (XOR of the first n odd numbers).
This sequence is similar to A044449 (numbers n such that string 1,3 occurs in the base 4 representation of n but not of n+1), but it contains additional terms. An example is 119. Its base 4 representation is 1313 while the base 4 representation of 120 is 1320. It may be that another workable definition of the sequence is -- numbers n in base 4 representation such that string 1,3 occurs one less time in n+1 than n, but I have not been able to check this.
The difference between the numbers in the sequence is always either 8 or 16, however there appears to be no recurring repetitions in it. Writing the 8 as a 0 and the 16 as a 1 (or dividing the difference pattern by 2 and subtracting a 1) produces a difference pattern of: 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1... which is an infinite word.
A similar process writing Even Odious over Even Evils produces 6, 22, 30, 38, 54, 70... which is twice A131323 (Odd numbers n such that the binary expansion ends in an even number of 1's), with all numbers along the path given by A047451 (numbers congruent to {0,6} mod 8) and yields the same difference pattern which produces the same infinite word.

Crossrefs

Cf. A001969 (evil numbers), A129771 (odd evil numbers).
Cf. A000069 (odious numbers), A092246 (odd odious numbers).
Cf. A047522 (numbers congruent to {1,7} mod 8).
Cf. A199398 (XOR of first n odd numbers).
Cf. A044449 (a subset of this sequence).
Cf. A131323 (odd numbers n such that the binary expansion ends in an even number of 1's).
Cf. A047451 (numbers congruent to {0,6} mod 8).
Cf. A000120 (binary weight of n).
Cf. A079523.

Programs

  • Magma
    //Function Bweight calculates the binary weight of an integer
    Bweight := function(m)
    Bweight:=0;
    adigs := Intseq(m,2);
    for n:= 1 to Ilog2(m)+1 do
      Bweight:=Bweight+adigs[n];
    end for;
    return Bweight;
    end function;
    prevodi:=0;
    currodi:=0;
    m:=0;
    count:=0;
    for n:= 1 to 20000 by 2 do
        m:=m+1;
        if (Bweight(n) mod 2 eq 1) then odious:=true; else odious:=false; end if;
        if (odious) then currodi:=n; end if;
           if (currodi - prevodi eq 4) then
              if (m mod 2 eq 1) then count:=count+1; count,n-2;
                 else count:=count+1;count,n-4;
           end if;
        end if;
        if(odious) then prevodi:=currodi; end if;
    end for;
    
  • Mathematica
    2*Select[Range[1, 320, 2], EvenQ[IntegerExponent[# + 1, 2]] &] + 1 (* Amiram Eldar, Jul 24 2023 *)
  • PARI
    is(n)=n%4==3 && valuation(n\4+1, 2)%2 \\ Charles R Greathouse IV, Aug 20 2013
    
  • Python
    from itertools import count, islice
    def A225822_gen(startvalue=1): # generator of terms >= startvalue
        return map(lambda m:(m<<1)+1,filter(lambda n:n&1 and not (~(n+1)&n).bit_length()&1,count(max(startvalue,1))))
    A225822__list = list(islice(A225822_gen(),30)) # Chai Wah Wu, Jul 09 2022

Formula

a(n) = 2*A131323(n) + 1.
a(n) = 4*A079523(n) + 3. - Charles R Greathouse IV, Aug 20 2013
a(n) ~ 12n. (In particular, a(n) = 12n + O(log n).) - Charles R Greathouse IV, Aug 20 2013
Previous Showing 21-30 of 36 results. Next