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

A305371 The binary expansions of b(n+1) and b(n) are required to have 1's in common at exactly the positions where a(n) has a 1 in its binary expansion, where b() is A305369.

Original entry on oeis.org

1, 2, 0, 4, 1, 8, 0, 6, 1, 16, 0, 10, 1, 20, 0, 32, 1, 12, 0, 18, 1, 36, 0, 24, 1, 34, 0, 28, 1, 64, 0, 14, 1, 48, 0, 66, 1, 40, 0, 22, 1, 72, 0, 38, 1, 80, 0, 42, 1, 68, 0, 26, 1, 96, 0, 30, 1, 128, 0, 44, 1, 82, 0, 132, 1, 50, 0, 76, 1, 130, 0, 52, 1, 74, 0, 144, 1, 46, 0, 192, 1, 54, 0, 136, 1, 70, 0, 56, 1, 134
Offset: 1

Views

Author

N. J. A. Sloane, Jun 02 2018

Keywords

Comments

The definition here is a consequence (or restatement) of the definition of A305369. The connection with A109812 is at present only an empirical observation.

Examples

			a(8) = 6 = 110_2, which expresses the fact that A305369(8) = 6 = 110_2 and A303369(9) = 7 = 111_2 have binary expensions whose common 1's are 110_2.
		

Crossrefs

Formula

Empirical: For k >= 0, a(4k+1)=1, a(4k+3)=0; for k >= 1, a(2k)=2*A109812(k).

A352578 a(n) = binary weight of A305369(n).

Original entry on oeis.org

1, 2, 1, 1, 2, 2, 1, 2, 3, 2, 1, 2, 3, 3, 2, 1, 2, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 3, 4, 2, 1, 3, 4, 3, 2, 2, 3, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 4, 5, 2, 1, 3, 4, 4, 3, 2, 3, 4, 3, 3, 4, 3, 2, 3, 4, 4, 3, 2, 3, 5, 4, 2, 3, 5, 4, 2, 3, 4, 3, 3, 4, 4, 3, 3, 4, 3, 2, 4, 5, 4, 3, 1, 2, 5, 4, 3, 4, 3, 2, 4, 5, 4, 3, 2, 3, 5, 4, 3, 4
Offset: 1

Views

Author

N. J. A. Sloane, Apr 07 2022

Keywords

Crossrefs

Cf. A305369.

A109812 a(1)=1; thereafter a(n) = smallest positive integer not among the earlier terms of the sequence such that a(n) and a(n-1) have no common 1-bits in their binary representations.

Original entry on oeis.org

1, 2, 4, 3, 8, 5, 10, 16, 6, 9, 18, 12, 17, 14, 32, 7, 24, 33, 20, 11, 36, 19, 40, 21, 34, 13, 48, 15, 64, 22, 41, 66, 25, 38, 65, 26, 37, 72, 23, 96, 27, 68, 35, 28, 67, 44, 80, 39, 88, 128, 29, 98, 129, 30, 97, 130, 45, 82, 132, 42, 69, 50, 73, 52, 74, 49, 70, 56, 71, 136, 51
Offset: 1

Views

Author

Leroy Quet, Aug 16 2005

Keywords

Comments

Theorem: Sequence is a permutation of the positive integers. - Leroy Quet, Aug 16 2005
Proof: It is clear that the sequence is infinite. The first time a number >= 2^k appears (for k>1), it must BE 2^k, and is therefore immediately followed by the smallest missing number. Since there are infinitely many powers of 2, every number will eventually appear. - N. J. A. Sloane, Jun 02 2018, rewritten Apr 03 2022
The sequence should really begin with a(0) = 0, a(1) = 1, a(2) = 2, etc., and be defined simply as "the lexicographically earliest infinite sequence of nonnegative numbers such that the binary expansions of adjacent terms are disjoint". There is also an obvious equivalent definition as a sequence of subsets of the nonnegative integers such that successive subsets are disjoint. But for historical reasons we will keep the present definition. - N. J. A. Sloane, Apr 04 2022
Inverse permutation = A113233; A113232 = a(a(n)). - Reinhard Zumkeller, Oct 19 2005
Sequence of fixed points, where a(n) = n, is A340016. - Thomas Scheuerle, Dec 24 2020
Comment from Rémy Sigrist, Apr 04 2022 [added by N. J. A. Sloane, Apr 06 2022]: (Start)
If we compare the log scatterplots of the even and odd bisections of this sequence, usually everything is scrambled, but on some large intervals the bisections appear as two parallel stripes.
On these intervals, for some constant k,
- one bisection has values of the form 2^k + something < 2^(k-1)
- the other bisection has values < 2^(k-1).
This is shown in the pair of Sigrist "The two bisections" links. (End)
Comment from N. J. A. Sloane, Apr 06 2022: (Start)
Near Gavarnie France there is a gap in the wall of the Pyrenees known as the Brèche de Roland. The graph of the present sequence shows a sequence of very similar gaps or brèches, at slightly irregular intervals.
It is hoped that if the positions of these brèches can be identified, this will provide a key to the structure of this mysterious sequence.
If the reader clicks the "graph" button here, the top graph shows an obvious brèche between n=59 and n=71. This is also shown in one of the links below.
[More information about the positions of the brèches will be added here soon.] (End)
If a(m) AND a(n) = a(m) then m <= n. - Rémy Sigrist, Apr 04 2022
It appears that a(n)/n is bounded (it is probably less than 4 for all n), and n/a(n) is unbounded. See A352336, A352359, A352917-A352923 and the conjectures therein. - David Broadhurst, Apr 17 2022
This is also a lookup-table for a strategy of the 2-player 2-heap misere-Nim game (where a winning position is indicated by a XOR Nim-sum of the 2 heaps equal to zero). See e.g. A048833. - R. J. Mathar, Apr 29 2022
The set-theory analog of A093714 is essentially the same sequence as this. The definition is: b(0)=0; thereafter b(n+1) = smallest missing nonnegative integer which is different from b(n)+1 and whose binary expansion has no 1-bit in common with the binary expansion of b(n). This begins 0, 2, 1, 4, 3, 8, ..., and b(n) = a(n) for n > 2. - N. J. A. Sloane, May 07 2022

Examples

			a(6) = 5, which is 101 in binary. Of the terms not among (1,2,4,3,8,5), the earlier terms of the sequence, 10 (decimal) = 1010 (binary) is the smallest positive integer with no common 1-bits with the binary representation of 5.
Of the other positive integers not occurring earlier in the sequence (6 = 110 binary, 7 = 111 binary, 9 = 1001 binary), each has at least one 1-bit in common with 5 = 101 in binary.
So a(7) = 10.
To illustrate the formulas (3) & (4): The powers of two a(3) = 4, a(5) = 8, a(8) = 16, and a(15) = 32 are immediately followed by 3, 5, 6 and 7, respectively, which are the smallest numbers that did not occur earlier. - _M. F. Hasler_, Apr 03 2022
		

Crossrefs

For positions of powers of 2 see A305370.
Records: A352203, A352204; parity: A352569, A352570; written in binary: A352575.
Partial sums: A352781.
See also A093714, A305369, A352794.
The graphs of A109812, A252867, A305369, A305372 (bisection) all have roughly the same, mysterious, fractal-like structure. - N. J. A. Sloane, Jun 03 2018

Programs

Formula

It would be nice to have a formula or recurrence. - N. J. A. Sloane, Jun 02 2018
From M. F. Hasler, Apr 03 2022: (Start)
(1) If a(n) = 2^k and a(m) > 2^k then m > n: No term larger than 2^k can occur earlier than 2^k.
(2) For all k >= 0, a(n) = 2^k for some n <= 2^k: Any power of two will occur, not later than immediately after all smaller numbers.
(3) If a(n) = 2^k, and S(k) = {x < 2^k | x <> a(j) for all j < n} is not empty (which seems to be the case for all k > 1), then a(n+1) = min S(k): The smallest number less than a power of two that does not occur before it must occur immediately after it.
(4) If a(n) = 2^k with n < 2^k (probably true for all k > 1), then a(n+1) = min {x | x <> a(j) for all j <= n}. (End)

Extensions

More terms from John W. Layman, Aug 18 2005
Edited by N. J. A. Sloane, Jun 02 2018

A329333 There is exactly one odd prime among the pairwise sums of any three consecutive terms: Lexicographically earliest sequence of distinct nonnegative integers with this property.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

This is conjectured and designed to be a permutation of the nonnegative integers, therefore the offset is taken to be zero.
Restricted to positive indices, this is a sequence of positive integers having the same property, then conjectured to be a permutation of the positive integers. (The word "odd" can be omitted in this case.)
If the word "odd" is dropped from the original definition, the sequence starts (0, 1, 3, 6, 2, 7), and then continues from a(6) = 4 onward as the present sequence. This is again conjectured to be a permutation of the nonnegative integers, and a permutation of the positive integers when restricted to the domain [1..oo). The latter however no longer has the property of lexicographic minimality.
See the OEIS wiki page for further considerations about existence, surjectivity and variants. - M. F. Hasler, Nov 24 2019

Examples

			For the first two terms there is no restriction regarding primality, so a(0) = 0, a(1) = 1. (If only positive values and indices are considered, then a(1) = 1 and a(2) = 2.)
Then a(2) must be such that among { 0+1, 0+a(2), 1+a(2) } there is exactly one odd prime, and 2 works.
Then a(3) must be such that among { 1+2, 1+a(3), 2+a(3) } there is only one (odd) prime. Since 1+2 = 3, the other two sums must both yield a composite. This excludes 3, 4, 5 and 6 and the smallest possibility is a(3) = 7.
And so on.
		

Crossrefs

For the primes that arise, or are missing, see A328997, A328998.
See A329450 for the variant having 0 primes among a(n+i) + a(n+j), 0 <= i < j < 3.
See A329452 for the variant having 2 primes among a(n+i) + a(n+j), 0 <= i < j < 4.
A084937, A305369 have comparable conditions on three consecutive terms.

Programs

  • Mathematica
    a[0]=0;a[1]=1;a[2]=2;a[n_]:=a[n]=(k=1;While[Length@Select[Plus@@@Subsets[{a[n-1],a[n-2],++k},{2}],PrimeQ]!=1||MemberQ[Array[a,n-1,0],k]];k);Array[a,100,0] (* Giorgos Kalogeropoulos, May 07 2021 *)
  • PARI
    A329333(n,show=0,o=0,p=0,U=[])={for(n=o,n-1, show&&print1(o","); U=setunion(U,[o]); while(#U>1&&U[1]==U[2]-1,U=U[^1]); for(k=U[1]+1,oo, setsearch(U,k)|| if(isprime(o+p), isprime(o+k)|| isprime(p+k), isprime(o+k)==isprime(p+k)&&p)||[o&&p=o, o=k, break]));o} \\ Optional args: show = 1: print all values up to a(n); o = 1: start with a(1) = 1; p = 1: compute the variant with a(2) = 3. See the wiki page for more general code which returns the whole vector: Use S(n_max,1,3,1) or S(n_max,1,3,2,[0,1]); S(n_max,1,3,0) gives the variant (0, 1, 3, ...)

Extensions

Entry revised by N. J. A. Sloane, Nov 14 2019 and M. F. Hasler, Nov 15 2019

A252867 a(n) = n if n <= 2, otherwise the smallest number not occurring earlier having in its binary representation at least one bit in common with a(n-2), but none with a(n-1).

Original entry on oeis.org

0, 1, 2, 5, 10, 4, 3, 12, 17, 6, 9, 18, 8, 7, 24, 33, 14, 32, 11, 36, 19, 40, 16, 13, 48, 15, 80, 34, 20, 35, 28, 65, 22, 41, 66, 21, 42, 68, 25, 38, 72, 23, 64, 26, 69, 50, 73, 52, 67, 44, 81, 46, 129, 30, 97, 130, 29, 98, 132, 27, 100, 131, 56, 70, 49, 74, 37, 82
Offset: 0

Views

Author

Keywords

Comments

Conjectured to be a permutation of the nonnegative integers. [Comment modified by N. J. A. Sloane, Jan 10 2015]
This is a purely set-based version of A098550, using the binary representation of numbers.
An equivalent definition in terms of sets: S(0) = {}, S(1) = {0}, S(2) = {1}; thereafter S(n) is the smallest set (different from the S(i) with i < n) of nonnegative integers such that S(n) meets S(n-2) but is disjoint from S(n-1). - N. J. A. Sloane, Mar 27 2022; corrected Aug 01 2022.

Examples

			The sequence of sets is {}, {0}, {1}, {0,2}, {1,3}, {2}, {0,1}, {2,3}. After the initial 3 terms, S(n) is the minimum set (as ordered by A048793) that has a nonempty intersection with S(n-2) but empty intersection with S(n-1). [Typos corrected by _N. J. A. Sloane_, Aug 01 2022 at the suggestion of _Michel Dekking_.]
Comment from _N. J. A. Sloane_, Dec 31 2014: The binary expansions of the first few terms are:
0  = 000000
1  = 000001
2  = 000010
5  = 000101
10 = 001010
4  = 000100
3  = 000011
12 = 001100
17 = 010001
6  = 000110
9  = 001001
18 = 010010
8  = 001000
7  = 000111
24 = 011000
33 = 100001
14 = 001110
32 = 100000
11 = 001011
36 = 100100
19 = 010011
40 = 101000
...
		

Crossrefs

Reading this sequence mod 2 gives A253050 and A253051.
Cf. A253581, A253582, A253589 (binary weight), A253603.
Analyzed further in A303596, A303597, A303598, A303599, A305368.
The graphs of A109812, A252867, A305369, A305372 all have roughly the same, mysterious, fractal-like structure. - N. J. A. Sloane, Jun 03 2018

Programs

  • Haskell
    import Data.Bits ((.&.)); import Data.List (delete)
    a252867 n = a252867_list !! n
    a252867_list = 0 : 1 : 2 : f 1 2 [3..] where
       f :: Int -> Int -> [Int] -> [Int]
       f u v ws = g ws where
         g (x:xs) = if x .&. u > 0 && x .&. v == 0
                       then x : f v x (delete x ws) else g xs
    -- Reinhard Zumkeller, Dec 24 2014
    
  • Maple
    read("transforms") : # define ANDnos
    A252867 := proc(n)
        local a,known,i ;
        option remember;
        if n <=2 then
            n;
        else
            for a from 3 do
                known := false ;
                for i from 1 to n-1 do
                    if procname(i) = a then
                        known := true;
                        break;
                    end if;
                end do:
                if not known then
                    if ANDnos(a, procname(n-1)) = 0 and ANDnos(a,procname(n-2)) > 0 then
                        return a;
                    end if;
                end if;
            end do:
        end if
    end proc:
    seq(A252867(n),n=0..200) ; # R. J. Mathar, May 02 2024
  • Mathematica
    a[n_] := a[n] = If[n<3, n, For[k=3, True, k++, If[FreeQ[Array[a, n-1], k], If[BitAnd[k, a[n-2]] >= 1 && BitAnd[k, a[n-1]] == 0, Return[k]]]]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Oct 03 2018 *)
  • PARI
    invecn(v,k,x)=for(i=1,k,if(v[i]==x,return(i)));0
    alist(n)=local(v=vector(n,i,i-1), x); for(k=4, n, x=3; while(invecn(v, k-1, x)||!bitand(v[k-2], x)||bitand(v[k-1],x), x++); v[k]=x); v
    
  • Python
    A252867_list, l1, l2, s, b = [0,1,2], 2, 1, 3, set()
    for _ in range(10**2):
        i = s
        while True:
            if not (i in b or i & l1) and i & l2:
                A252867_list.append(i)
                l2, l1 = l1, i
                b.add(i)
                while s in b:
                    b.remove(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 27 2014

A305372 A109812(2k+1).

Original entry on oeis.org

1, 4, 8, 10, 6, 18, 17, 32, 24, 20, 36, 40, 34, 48, 64, 41, 25, 65, 37, 23, 27, 35, 67, 80, 88, 29, 129, 97, 45, 132, 69, 73, 74, 70, 71, 51, 131, 192, 160, 144, 84, 54, 46, 134, 194, 138, 162, 146, 139, 133, 196, 256, 208, 62, 55, 258, 322, 83, 89, 264, 161, 145, 152, 148, 135, 259, 163, 90, 266, 154, 106, 288
Offset: 0

Views

Author

N. J. A. Sloane, Jun 02 2018

Keywords

Comments

It appears that this is the same as A305369(4k+3)/2.
This is an (apparent) link between A109812 and A305369, and a formula or recurrence would benefit both sequences.

Crossrefs

The graphs of A109812, A252867, A305369, A305372 all have roughly the same, mysterious, fractal-like structure. - N. J. A. Sloane, Jun 03 2018
Showing 1-6 of 6 results.