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-10 of 16 results. Next

A133097 a(n) = A005282(n) - A011185(n-1).

Original entry on oeis.org

0, 0, 1, 3, 5, 8, 10, 15, 27, 28, 23, 28, 20, 30, 22, 40, 32, 45, 27, 62, 89, 62, 116, 167, 105, 118, 108, 51, 99, 151, 88, 137, 137, 265, 174, 195, 320, 321, 249, 283, 226, 281, 293, 394, 465, 369, 585, 565, 639, 404, 483, 221, 233, 428, 384, 370, 527, 431, 818
Offset: 1

Views

Author

Klaus Brockhaus, Sep 17 2007

Keywords

Comments

Also A025582(n) - A010672(n-1).
A005282 is the sequence of smallest numbers such that the pairwise sums of not necessarily distinct elements are all distinct, whereas A011185 is the sequence of smallest numbers such that the pairwise sums of distinct elements are all distinct.
Sequence has negative terms; the first one is a(65) = -130.

Examples

			a(6) = A005282(6) - A011185(6) = 21 - 13 = 8.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    from collections import deque
    def A133097_gen(): # generator of terms
        aset2, alist, bset2, blist, aqueue, bqueue = set(), [], set(), [], deque(), deque()
        for k in count(1):
            cset2 = {k<<1}
            if (k<<1) not in aset2:
                for a in alist:
                    if (m:=a+k) in aset2:
                        break
                    cset2.add(m)
                else:
                    aqueue.append(k)
                    alist.append(k)
                    aset2.update(cset2)
            cset2 = set()
            for b in blist:
                if (m:=b+k) in bset2:
                    break
                cset2.add(m)
            else:
                bqueue.append(k)
                blist.append(k)
                bset2.update(cset2)
            if len(aqueue) > 0 and len(bqueue) > 0:
                yield aqueue.popleft()-bqueue.popleft()
    A133097_list = list(islice(A133097_gen(),30)) # Chai Wah Wu, Sep 11 2023

A133605 Elements of A011185 that are also the sum of a pair of distinct elements of A011185.

Original entry on oeis.org

3, 5, 8, 13, 21, 74, 95, 182, 212, 413, 862, 1060, 1435, 1934, 4447, 5323, 7588, 19934, 23725, 24970, 29558, 43344, 45425, 48622, 55240, 63835, 91336, 98178, 177387, 180356, 206088, 333837, 400924, 418503, 429115, 598604, 776150, 990510, 993089
Offset: 1

Views

Author

Klaus Brockhaus, Sep 18 2007

Keywords

Comments

A011185 is the sequence of smallest numbers such that the pairwise sums of distinct elements are all distinct.

Examples

			A011185(1) = 1, A011185(2) = 2. 1 + 2 = 3 = A011185(3), hence 3 is in the sequence.
A011185(16) = 212, A011185(35) = 1722. 212 + 1722 = 1934 = A011185(37), hence 1934 is in the sequence.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A133605_gen(): # generator of terms
        aset2, alist = set(), []
        for k in count(1):
            bset2 = set()
            for a in alist:
                if (b:=a+k) in aset2:
                    break
                bset2.add(b)
            else:
                if k in aset2:
                    yield k
                alist.append(k)
                aset2.update(bset2)
    A133605_list = list(islice(A133605_gen(),30)) # Chai Wah Wu, Sep 11 2023

A005282 Mian-Chowla sequence (a B_2 sequence): a(1) = 1; for n>1, a(n) = smallest number > a(n-1) such that the pairwise sums of elements are all distinct.

Original entry on oeis.org

1, 2, 4, 8, 13, 21, 31, 45, 66, 81, 97, 123, 148, 182, 204, 252, 290, 361, 401, 475, 565, 593, 662, 775, 822, 916, 970, 1016, 1159, 1312, 1395, 1523, 1572, 1821, 1896, 2029, 2254, 2379, 2510, 2780, 2925, 3155, 3354, 3591, 3797, 3998, 4297, 4433, 4779, 4851
Offset: 1

Views

Author

Keywords

Comments

An alternative definition is to start with 1 and then continue with the least number such that all pairwise differences of distinct elements are all distinct. - Jens Voß, Feb 04 2003. [However, compare A003022 and A227590. - N. J. A. Sloane, Apr 08 2016]
Rachel Lewis points out [see link] that S, the sum of the reciprocals of this sequence, satisfies 2.158435 <= S <= 2.158677. Similarly, the sum of the squares of reciprocals of this sequence converges to approximately 1.33853369 and the sum of the cube of reciprocals of this sequence converges to approximately 1.14319352. - Jonathan Vos Post, Nov 21 2004; comment changed by N. J. A. Sloane, Jan 02 2020
Let S denote the reciprocal sum of a(n). Then 2.158452685 <= S <= 2.158532684. - Raffaele Salvia, Jul 19 2014
From Thomas Ordowski, Sep 19 2014: (Start)
Known estimate: n^2/2 + O(n) < a(n) < n^3/6 + O(n^2).
Conjecture: a(n) ~ n^3 / log(n)^2. (End)

Examples

			The second term is 2 because the 3 pairwise sums 1+1=2, 1+2=3, 2+2=4 are all distinct.
The third term cannot be 3 because 1+3 = 2+2. But it can be 4, since 1+4=5, 2+4=6, 4+4=8 are distinct and distinct from the earlier sums 1+1=2, 1+2=3, 2+2=4.
		

References

  • P. Erdős and R. Graham, Old and new problems and results in combinatorial number theory. Monographies de L'Enseignement Mathématique (1980).
  • S. R. Finch, Mathematical Constants, Cambridge, 2003, Section 2.20.2.
  • R. K. Guy, Unsolved Problems in Number Theory, E28.
  • A. M. Mian and S. D. Chowla, On the B_2-sequences of Sidon, Proc. Nat. Acad. Sci. India, A14 (1944), 3-4.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Row 2 of A347570.
Cf. A051788, A080200 (for differences between terms).
Different from A046185. Cf. A011185.
See also A003022, A227590.
A259964 has a greater sum of reciprocals.
Cf. A002858.

Programs

  • Haskell
    import Data.Set (Set, empty, insert, member)
    a005282 n = a005282_list !! (n-1)
    a005282_list = sMianChowla [] 1 empty where
       sMianChowla :: [Integer] -> Integer -> Set Integer -> [Integer]
       sMianChowla sums z s | s' == empty = sMianChowla sums (z+1) s
                            | otherwise   = z : sMianChowla (z:sums) (z+1) s
          where s' = try (z:sums) s
                try :: [Integer] -> Set Integer -> Set Integer
                try []     s                      = s
                try (x:sums) s | (z+x) `member` s = empty
                               | otherwise        = try sums $ insert (z+x) s
    -- Reinhard Zumkeller, Mar 02 2011
    
  • Maple
    a[1]:= 1: P:= {2}: A:= {1}:
    for n from 2 to 100 do
      for t from a[n-1]+1 do
        Pt:= map(`+`,A union {t},t);
        if Pt intersect P = {} then break fi
      od:
      a[n]:= t;
      A:= A union {t};
      P:= P union Pt;
    od:
    seq(a[n],n=1..100); # Robert Israel, Sep 21 2014
  • Mathematica
    t = {1}; sms = {2}; k = 1; Do[k++; While[Intersection[sms, k + t] != {}, k++]; sms = Join[sms, t + k, {2 k}]; AppendTo[t, k], {49}]; t (* T. D. Noe, Mar 02 2011 *)
  • PARI
    A005282_vec(N, A=[1], U=[0], D(A, n=#A)=vector(n-1, k, A[n]-A[n-k]))={ while(#A2 && U=U[k-1..-1]);A} \\ M. F. Hasler, Oct 09 2019
    
  • PARI
    aupto(L)= my(S=vector(L), A=[1]); for(i=2, L, for(j=1, #A, if(S[i-A[j]], next(2))); for(j=1, #A, S[i-A[j]]=1); A=concat(A, i)); A \\ Ruud H.G. van Tol, Jun 30 2025
    
  • Python
    from itertools import count, islice
    def A005282_gen(): # generator of terms
        aset1, aset2, alist = set(), set(), []
        for k in count(1):
            bset2 = {k<<1}
            if (k<<1) not in aset2:
                for d in aset1:
                    if (m:=d+k) in aset2:
                        break
                    bset2.add(m)
                else:
                    yield k
                    alist.append(k)
                    aset1.add(k)
                    aset2 |= bset2
    A005282_list = list(islice(A005282_gen(),30)) # Chai Wah Wu, Sep 05 2023

Formula

a(n) = A025582(n) + 1.
a(n) = (A034757(n)+1)/2.

Extensions

Examples added by N. J. A. Sloane, Jun 01 2008

A025582 A B_2 sequence: a(n) is the least value such that sequence increases and pairwise sums of elements are all distinct.

Original entry on oeis.org

0, 1, 3, 7, 12, 20, 30, 44, 65, 80, 96, 122, 147, 181, 203, 251, 289, 360, 400, 474, 564, 592, 661, 774, 821, 915, 969, 1015, 1158, 1311, 1394, 1522, 1571, 1820, 1895, 2028, 2253, 2378, 2509, 2779, 2924, 3154, 3353, 3590, 3796, 3997, 4296, 4432, 4778, 4850
Offset: 1

Views

Author

Keywords

Comments

a(n) is also the least value such that sequence increases and pairwise differences of distinct elements are all distinct.

Examples

			After 0, 1, a(3) cannot be 2 because 2+0 = 1+1, so a(3) = 3.
		

Crossrefs

Row 2 of A365515.
See A011185 for more information.
A010672 is a similar sequence, but there the pairwise sums of distinct elements are all distinct.

Programs

  • Python
    from itertools import count, islice
    def A025582_gen(): # generator of terms
        aset1, aset2, alist = set(), set(), []
        for k in count(0):
            bset2 = {k<<1}
            if (k<<1) not in aset2:
                for d in aset1:
                    if (m:=d+k) in aset2:
                        break
                    bset2.add(m)
                else:
                    yield k
                    alist.append(k)
                    aset1.add(k)
                    aset2 |= bset2
    A025582_list = list(islice(A025582_gen(),20)) # Chai Wah Wu, Sep 01 2023
  • Sage
    def A025582_list(n):
        a = [0]
        psums = set([0])
        while len(a) < n:
            a += [next(k for k in IntegerRange(a[-1]+1, infinity) if not any(i+k in psums for i in a+[k]))]
            psums.update(set(i+a[-1] for i in a))
        return a[:n]
    print(A025582_list(20))
    # D. S. McNeil, Feb 20 2011
    

Formula

a(n) = A005282(n) - 1. - Tyler Busby, Mar 16 2024

A066720 The greedy rational packing sequence: a(1) = 1; for n > 1, a(n) is smallest number such that the ratios a(i)/a(j) for 1 <= i < j <= n are all distinct.

Original entry on oeis.org

1, 2, 3, 5, 7, 8, 11, 13, 17, 18, 19, 23, 29, 31, 37, 41, 43, 47, 50, 53, 59, 60, 61, 67, 71, 73, 79, 81, 83, 89, 97, 98, 101, 103, 105, 107, 109, 113, 127, 128, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239
Offset: 1

Views

Author

N. J. A. Sloane, Jan 15 2002

Keywords

Comments

Sequence was apparently invented by Jeromino Wannhoff - see the Rosenthal link.
An equivalent definition: a(1) = 1, a(2) = 2 and thereafter a(n) is the smallest number such that all a(i)*a(j) are different. - Thanks to Jean-Paul Delahaye for this comment. - N. J. A. Sloane, Oct 01 2020
If you replace the word "ratio" with "difference" and start from 1 using the same greedy algorithm you get A005282. - Sharon Sela (sharonsela(AT)hotmail.com), Jan 15 2002
Taking a(n) as the smallest number such that the pairwise sums a(i)+a(j) (iA011185. - Jean-Paul Delahaye, Oct 02 2020. [This replaces an incorrect comment.]
Does every rational number appear as a ratio? See A066657, A066658.
Contains all primes. Differs from A066724 in that the latter forbids only the products of distinct terms. - Ivan Neretin, Mar 02 2016

Examples

			After 5, 7 is the next member and not 6 as 6*1 = 2*3.
		

Crossrefs

Consists of the primes together with A066721.
For the rationals that are produced see A066657/A066658 and A066848, A066849.

Programs

  • Haskell
    import qualified Data.Set as Set (null)
    import Data.Set as Set (empty, insert, member)
    a066720 n = a066720_list !! (n-1)
    a066720_list = f [] 1 empty where
       f ps z s | Set.null s' = f ps (z + 1) s
                | otherwise   = z : f (z:ps) (z + 1) s'
         where s' = g (z:ps) s
               g []     s                      = s
               g (x:qs) s | (z * x) `member` s = empty
                          | otherwise          = g qs $ insert (z * x) s
    -- Reinhard Zumkeller, Nov 19 2013
  • Maple
    A[1]:= 1:
    F:= {1}:
    for n from 2 to 100 do
    for k from A[n-1]+1 do
    Fk:= {k^2, seq(A[i]*k,i=1..n-1)};
    if Fk intersect F = {} then
    A[n]:= k;
    F:= F union Fk;
    break
    fi
    od
    od:
    seq(A[i],i=1..100); # Robert Israel, Mar 02 2016
  • Mathematica
    s={1}; xok := Module[{}, For[i=1, i<=n, i++, For[j=1; k=Length[dl=Divisors[s[[i]]x]], j<=k, j++; k--, If[MemberQ[s, dl[[j]]]&&MemberQ[s, dl[[k]]], Return[False]]]]; True]; For[n=1, True, n++, Print[s[[n]]]; For[x=s[[n]]+1, True, x++, If[xok, AppendTo[s, x]; Break[]]]] (* Dean Hickerson *)
    a[1] = 1; a[n_] := a[n] = Block[{k = a[n - 1] + 1, b = c = Table[a[i], {i, 1, n - 1}], d}, While[c = Append[b, k]; Length[ Union[ Flatten[ Table[ c[[i]]/c[[j]], {i, 1, n}, {j, 1, n}]]]] != n^2 - n + 1, k++ ]; Return[k]]; Table[ a[n], {n, 1, 75} ] (* Robert G. Wilson v *)
    nmax = 100; a[1] = 1; F = {1};
    For[n = 2, n <= nmax, n++,
    For[k = a[n-1]+1, True, k++, Fk = Join[{k^2}, Table[a[i]*k, {i, 1, n-1}]] // Union; If[Fk ~Intersection~ F == {}, a[n] = k; F = F ~Union~ Fk; Break[]
    ]]];
    Array[a, nmax] (* Jean-François Alcover, Mar 26 2019, after Robert Israel *)
  • PARI
    {a066720(m) = local(a,rat,n,s,new,b,i,k,j); a=[]; rat=Set([]); n=0; s=0; while(sKlaus Brockhaus, Feb 23 2002
    

Extensions

More terms from Dean Hickerson, Klaus Brockhaus and David Applegate, Jan 15 2002
Entry revised by N. J. A. Sloane, Oct 01 2020.

A010672 A B_2 sequence: a(n) = least value such that the sequence increases and pairwise sums of distinct terms are all distinct.

Original entry on oeis.org

0, 1, 2, 4, 7, 12, 20, 29, 38, 52, 73, 94, 127, 151, 181, 211, 257, 315, 373, 412, 475, 530, 545, 607, 716, 797, 861, 964, 1059, 1160, 1306, 1385, 1434, 1555, 1721, 1833, 1933, 2057, 2260, 2496, 2698, 2873, 3060, 3196, 3331, 3628, 3711, 3867, 4139, 4446, 4639
Offset: 0

Views

Author

Keywords

Crossrefs

A025582 is a similar sequence, but there the pairwise sums of (not necessarily distinct) elements are all distinct.
Cf. A011185.

Programs

  • MATLAB
    N = 3*10^8; % to get all terms < N
    Cands = ones(N,1);
    Delta = [];
    A = [];
    n = 1;
    while nnz(Cands) > 0
          A(n) = find(Cands,1,'first');
          Cands(A(n)) = 0;
          Rem = Delta(Delta <= N - A(n)) + A(n);
          Cands(Rem) = 0;
          Delta = union(Delta, -A(1:n-1)+A(n));
          if mod(n,10)==0
           fprintf('a(%d)=%d\n',n,A(n));
           toc;
          end
          n = n + 1;
    end
    A - 1 % Robert Israel, May 02 2016
    
  • Maple
    N:= 10^6: # to get all terms <= N
    A[0]:= 0: Delta:= {}: As:= {A[0]}:
    Cands:= {$1..N}:
    for n from 1  while Cands <> {} do
      A[n]:= min(Cands);
      Cands:= Cands minus ({A[n]} union map(`+`,Delta, A[n]));
      Delta:= Delta union map(t ->A[n] - t, As);
      As:= As union {A[n]};
    od:
    seq(A[i],i=0..n-1); # Robert Israel, May 02 2016
  • Mathematica
    seq = {0};
    pairSums = {};
    nextTerm = 1;
    pairSumsUpdate := Join[pairSums, nextTerm + seq]
    hasDuplicates := ! DuplicateFreeQ[pairSumsUpdate]
    Do[
     While[hasDuplicates, nextTerm++];
     pairSums = pairSumsUpdate;
     AppendTo[seq, nextTerm];
     , 50]
    seq (* David Trimas, Dec 28 2024 *)
  • Python
    from itertools import count, islice
    def A010672_gen(): # generator of terms
        aset2, alist = set(), []
        for k in count(0):
            bset2 = set()
            for a in alist:
                if (b:=a+k) in aset2:
                    break
                bset2.add(b)
            else:
                yield k
                alist.append(k)
                aset2.update(bset2)
    A010672_list = list(islice(A010672_gen(),30)) # Chai Wah Wu, Sep 11 2023

Formula

a(n) = A011185(n+1) - 1. - Robert Israel, May 02 2016

A036241 a(1)=1, a(2)=2, a(3)=3; for n >= 3, a(n) is smallest number such that all a(i) for 1 <= i <= n are distinct, all a(i)+a(j) for 1 <= i < j <= n are distinct and all a(i)+a(j)+a(k) for 1 <= i < j < k <= n are distinct.

Original entry on oeis.org

1, 2, 3, 5, 8, 14, 25, 45, 82, 140, 235, 388, 559, 839, 1286, 1582, 2221, 3144, 4071, 5795, 6872, 9204, 11524, 13796, 17686, 21489, 26019, 31080, 37742, 45067, 53144, 58365, 67917, 78484, 91767, 106513, 118600, 133486, 147633, 166034, 174717
Offset: 1

Views

Author

Keywords

Examples

			For {1,2,3,4} we have 1+4 = 2+3, so a(4) is not 4. For {1,2,3,5} the terms 1, 2, 3, 5 are distinct, the sums 1+2, 1+3, 1+5, 2+3, 2+5, 3+5 are distinct and the sums 1+2+3, 1+2+5, 1+3+5, 2+3+5 are distinct, so a(4) = 5.
		

References

  • Letter from V. Jooste, Pretoria, South Africa, Sep. 8, 1975.

Crossrefs

Programs

  • Haskell
    import qualified Data.Set as Set (null, map)
    import Data.Set (empty, fromList, toList, intersect, union)
    a036241 n = a036241_list !! (n-1)
    a036241_list = f [1..] [] empty empty where
       f (x:xs) ys s2 s3
        | null (s2' `intersect` y2s) && null (s3' `intersect` y3s)
          = x : f xs (x:ys) (fromList s2' `union` s2) (fromList s3' `union` s3)
        | otherwise = f xs ys s2 s3
        where s2' = sort $ map (x +) ys
              s3' = sort $ map (x +) y2s
              y2s = toList s2
              y3s = toList s3
    -- Reinhard Zumkeller, Oct 02 2011
    
  • Mathematica
    a[1]=1; a[2]=2; a[3]=3; a[n_] := a[n] = Catch[For[an = a[n-1] + 1, True, an++, a[n] = an; t2 = Flatten[Table[a[i] + a[j], {i, 1, n}, {j, i+1, n}]]; If[n*(n-1)/2 == Length[Union[t2]], t3 = Flatten[Table[a[i] + a[j] + a[k], {i, 1, n}, {j, i+1, n}, {k, j+1, n}]]; If[ n*(n-1)*(n-2)/6 == Length[Union[t3]], Throw[an]]]]]; Table[Print[a[n]]; a[n], {n, 1, 41}] (* Jean-François Alcover, Jul 24 2012 *)
  • PARI
    {unique(v)=local(b); b=1; for(j=2,length(v),if(v[j-1]==v[j],b=0)); b}
    {newsort(u,v,q)=local(s); s=[]; for(i=1,length(v),s=concat(s,v[i]+q)); vecsort(concat(u,s))}
    {m=175000; print1(1,",",2,",",3,","); w1=[1,2,3]; w2=[3,4,5]; w3=[6]; q=4; while(q
    				
  • Python
    from itertools import count, islice
    def A036241_gen(): # generator of terms
        aset2, aset3 = {3,4,5}, {6}
        yield from (alist:=[1,2,3])
        for k in count(4):
            bset2, bset3 = set(), set()
            for a in alist:
                if (b2:=a+k) in aset2:
                    break
                bset2.add(b2)
            else:
                for a2 in aset2:
                    if (b3:=a2+k) in aset3:
                        break
                    bset3.add(b3)
                else:
                    yield k
                    alist.append(k)
                    aset2.update(bset2)
                    aset3.update(bset3)
    A036241_list = list(islice(A036241_gen(),20)) # Chai Wah Wu, Sep 10 2023

Extensions

Better description and more terms from Naohiro Nomoto, Jul 02 2001
Edited by and terms a(30) to a(41) from Klaus Brockhaus, May 21 2003

A062295 A B_2 sequence: a(n) is the smallest square such that pairwise sums of not necessarily distinct elements are all distinct.

Original entry on oeis.org

1, 4, 9, 16, 25, 36, 64, 81, 100, 169, 256, 289, 441, 484, 576, 625, 841, 1089, 1296, 1444, 1936, 2025, 2401, 2601, 3136, 4225, 4356, 4624, 5329, 5476, 5776, 6084, 7569, 9025, 10201, 11449, 11664, 12321, 12996, 13456, 14400, 16129, 17956, 20164, 22201
Offset: 1

Views

Author

Labos Elemer, Jul 02 2001

Keywords

Examples

			36 is in the sequence since the pairwise sums of {1, 4, 9, 16, 25, 36} are all distinct: 2, 5, 8, 10, 13, 17, 18, 20, 25, 26, 29, 32, 34, 37, 40, 41, 45, 50, 52, 61, 72.
49 is not in the sequence since 1 + 49 = 25 + 25.
		

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A062295_gen(): # generator of terms
        aset1, aset2, alist = set(), set(), []
        for k in (n**2 for n in count(1)):
            bset2 = {k<<1}
            if (k<<1) not in aset2:
                for d in aset1:
                    if (m:=d+k) in aset2:
                        break
                    bset2.add(m)
                else:
                    yield k
                    alist.append(k)
                    aset1.add(k)
                    aset2 |= bset2
    A062295_list = list(islice(A062295_gen(),30)) # Chai Wah Wu, Sep 05 2023

Extensions

Edited, corrected and extended by Klaus Brockhaus, Sep 24 2007

A062294 A B_2 sequence: a(n) is the smallest prime such that the pairwise sums of distinct elements are all distinct.

Original entry on oeis.org

2, 3, 5, 7, 11, 17, 29, 47, 67, 83, 131, 163, 233, 307, 397, 443, 617, 727, 809, 941, 1063, 1217, 1399, 1487, 1579, 1931, 2029, 2137, 2237, 2659, 2777, 3187, 3659, 3917, 4549, 4877, 5197, 5471, 5981, 6733, 7207, 7349, 8039, 8291, 8543, 9283, 9689, 10037
Offset: 1

Views

Author

Labos Elemer, Jul 02 2001

Keywords

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy import nextprime
    def A062294_gen(): # generator of terms
        aset2, alist, k = set(), [], 0
        while (k:=nextprime(k)):
            bset2 = set()
            for a in alist:
                if (b:=a+k) in aset2:
                    break
                bset2.add(b)
            else:
                yield k
                alist.append(k)
                aset2.update(bset2)
    A062294_list = list(islice(A062294_gen(),30)) # Chai Wah Wu, Sep 11 2023

Extensions

Edited, corrected and extended by Klaus Brockhaus, Sep 17 2007

A360363 Lexicographically earliest sequence of distinct positive integers such that the bitwise XOR of two distinct terms are all distinct.

Original entry on oeis.org

1, 2, 3, 4, 8, 12, 16, 32, 48, 64, 85, 106, 128, 150, 171, 216, 237, 247, 256, 279, 297, 452, 512, 537, 558, 594, 640, 803, 860, 997, 1024, 1051, 1069, 1115, 1169, 1333, 1345, 1620, 1866, 2048, 2077, 2086, 2159, 2257, 2363, 2446, 2737, 2860, 3212, 3335, 3761
Offset: 1

Views

Author

Rémy Sigrist, Feb 04 2023

Keywords

Comments

This sequence is well defined as we can always extend it with a power of 2 not yet in the sequence.
This sequence contains all powers of 2 (A000079).
This sequence has similarities with A011185: here we combine terms with the bitwise XOR operator, there with the addition.
Every positive integer can be uniquely expressed as a(i) XOR a(j) with i < j (see A360364).

Examples

			The first terms are:
  n   a(n)  a(k) XOR a(n) (for k = 1..n-1)
  --  ----  ----------------------------------------------------------
   1     1  N/A
   2     2  3
   3     3  2, 1
   4     4  5, 6, 7
   5     8  9, 10, 11, 12
   6    12  13, 14, 15, 8, 4
   7    16  17, 18, 19, 20, 24, 28
   8    32  33, 34, 35, 36, 40, 44, 48
   9    48  49, 50, 51, 52, 56, 60, 32, 16
  10    64  65, 66, 67, 68, 72, 76, 80, 96, 112
  11    85  84, 87, 86, 81, 93, 89, 69, 117, 101, 21
  12   106  107, 104, 105, 110, 98, 102, 122, 74, 90, 42, 63
  13   128  129, 130, 131, 132, 136, 140, 144, 160, 176, 192, 213, 234
		

Crossrefs

Programs

  • Python
    from itertools import islice
    def agen(): # generator of terms
        aset, xset, k = set(), set(), 0
        while True:
            k += 1
            while any(k^an in xset for an in aset): k += 1
            yield k; xset.update(k^an for an in aset); aset.add(k)
    print(list(islice(agen(), 51))) # Michael S. Branicky, Feb 05 2023
Showing 1-10 of 16 results. Next