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
a(6) = A005282(6) - A011185(6) = 21 - 13 = 8.
-
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
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.
-
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
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.
- 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).
- T. D. Noe, Table of n, a(n) for n=1..5818 (terms less than 2*10^9)
- Thomas Bloom, Problem 340, Erdős Problems.
- Yin Choi Cheng, Greedy Sidon sets for linear forms, J. Num. Theor. (2024).
- Rachel Lewis, Mian-Chowla and B2 sequences, 1999. [Thanks to _Steven Finch_ for providing this document. Included with permission. - _N. J. A. Sloane_, Jan 02 2020]
- Kevin O'Bryant, B_h-Sets and Rigidity, arXiv:2312.10910 [math.NT], 2023.
- Raffaele Salvia, Table of n, a(n) for n=1...25000
- R. Salvia, A New Lower Bound for the Distinct Distance Constant, J. Int. Seq. 18 (2015) # 15.4.8.
- N. J. A. Sloane, Handwritten notes on Self-Generating Sequences, 1970 (note that A1148 has now become A005282)
- Eric Weisstein's World of Mathematics, B2 Sequence.
- Eric Weisstein's World of Mathematics, Chowla Sequence.
- Zhang Zhen-Xiang, A B_2-sequence with larger reciprocal sum, Math. Comp. 60 (1993), 835-839.
- Index entries for B_2 sequences.
A259964 has a greater sum of reciprocals.
-
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
-
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
-
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 *)
-
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
-
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
-
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
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
After 0, 1, a(3) cannot be 2 because 2+0 = 1+1, so a(3) = 3.
- David W. Wilson, Table of n, a(n) for n = 1..1000
- Alon Amit, What are some interesting proofs using transfinite induction?, Quora, Nov 15 2014.
- LiJun Zhang, Bing Li, and LeeTang Cheng, Constructions of QC LDPC codes based on integer sequences, Science China Information Sciences, June 2014, Volume 57, Issue 6, pp 1-14.
- Eric Weisstein's World of Mathematics, B2 Sequence.
- Index entries for B_2 sequences.
A010672 is a similar sequence, but there the pairwise sums of distinct elements are all distinct.
-
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
-
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
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
After 5, 7 is the next member and not 6 as 6*1 = 2*3.
Consists of the primes together with
A066721.
-
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
-
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
-
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 *)
-
{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
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
A025582 is a similar sequence, but there the pairwise sums of (not necessarily distinct) elements are all distinct.
-
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
-
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
-
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 *)
-
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
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
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.
- Letter from V. Jooste, Pretoria, South Africa, Sep. 8, 1975.
-
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
-
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 *)
-
{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
-
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
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
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.
-
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
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
-
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
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
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
-
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.
Comments