OFFSET
1,2
COMMENTS
"Sumset" of a set S = {s_i} means the set of sums of pairs, s_i + s_j with i <= j.
LINKS
Markus Sigg, Table of n, a(n) for n = 1..10000
EXAMPLE
The Collatz trajectory of 3 is {3,10,5,16,8,4,2,1}, which has the sumset {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,24,26,32} of size 23, so a(3) = 23.
PROG
(PARI) a(n) = {
my(T = List([n]), S = Set());
while(n > 1, n = if(n % 2 == 0, n/2, 3*n+1); listput(T, n));
for(i = 1, #T,
for(j = i, #T,
S = setunion(S, Set([T[i] + T[j]]));
)
);
#S
};
print(vector(59, n, a(n)));
(Python)
def a(n):
T, S = [n], set()
while n > 1:
if n & 1 == 0: n >>= 1
else: n = 3 * n + 1
T.append(n)
for i in range(len(T)):
for j in range(i, len(T)):
S.add(T[i] + T[j])
return len(S)
print([a(n) for n in range(1, 60)]) # Darío Clavijo, Aug 24 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Markus Sigg, Aug 24 2024
STATUS
approved