|
|
A287178
|
|
Smallest number such that the circular adjacent sum set has no multiple entries.
|
|
1
|
|
|
1, 2, 4, 8, 10, 16, 20, 28, 42, 30, 32, 52, 50, 68, 44, 96, 76, 142, 80, 148, 180, 56, 138, 226, 94, 188, 108, 92, 286, 306, 166, 256, 98, 498, 150, 266, 450, 250, 262, 540, 290, 460, 398, 474, 412, 402, 598, 272, 692, 144, 544, 240, 110, 906, 494, 752, 854, 248
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
Let a1, a2, ..., ak be the first k terms of a sequence. The term "circular adjacent sum set" is the set of sums of 1 to k adjacent terms, where a1 is taken to be adjacent to ak. For example if the first 3 terms of the sequence are 1, 2, and 4 then the circular adjacent sum set is {1,2,4,3,6,5,7}.
Another example. If the first three terms of the sequence are 1,2,3 then the circular adjacent sum set is {1,2,3,3,5,4,7}. One element is repeated because 3 is the sum of adjacent elements in 2 ways, as 3 and as 1+2.
|
|
LINKS
|
|
|
EXAMPLE
|
For n=4, and a(1)=1, a(2)=2, and a(3)=4. a(4) cannot be 1, 2, or 3 because then there would be two different sums equal to 3. a(4) cannot be 5 because 5+1=2+4. It cannot be 6 because 6=2+4. It cannot be 7 because 7=4+2+1. For a(4)=8 the circular adjacent sum set is {1,2,4,8,3,6,12,9,7,14,13,11,15}. All 13 of these sums are different, so a(4) is 8.
|
|
MATHEMATICA
|
ok[v_] := Block[{w = v, n = Length@v}, w=Reap[Do[w = RotateLeft[w]; Do[Sow[ Total@ Take[w, j]], {j, n - 1}], {n}]][[2, 1]]; Length[w] == Length@ Union@ w]; a = {1}; While[Length[a] < 30, AppendTo[a, 2]; While[! ok[a], a[[-1]]++]]; a (* Giovanni Resta, May 30 2017 *)
|
|
PROG
|
(Python)
a, isums, lsums, rsums, xsums = [], set(), set([0]), set([0]), set([0])
for i in range(100):
for new in range(1, sum(a)+2):
nrsums, nxsums = set([0]), set([0])
for x in rsums:
xn = x+new
if xn in isums or xn in lsums:
break
nrsums.add(xn)
else:
for x in xsums.union(lsums):
xn = x+new
if xn in isums or xn in rsums or xn in lsums:
break
nxsums.add(xn)
else:
a.append(new)
isums.update(rsums)
xsums, rsums = nxsums, nrsums
lsums.add(sum(a))
break
print(a)
(Python)
from itertools import count, islice
def A287178_gen(): # generator of terms
aset1, aset2, alist, n = set(), set(), [], 0
for k in count(1, 2):
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-n
n = k
alist.append(k)
aset1.add(k)
aset2.update(bset2)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|