[go: up one dir, main page]

login
Start with {1}, then at each step replace it with the set of all pairwise products and sums of its elements (an element can be paired with itself). a(n) gives the number of elements after n-th step.
2

%I #30 Apr 26 2022 16:08:09

%S 1,2,4,11,52,678,67144,357306081

%N Start with {1}, then at each step replace it with the set of all pairwise products and sums of its elements (an element can be paired with itself). a(n) gives the number of elements after n-th step.

%e After the 1st step the set becomes {1*1, 1+1} = {1, 2}. It has 2 distinct elements so a(1) = 2.

%e After the 2nd step the set becomes {1*1, 1+1, 1*2, 1+2, 2*2, 2+2} = {1, 2, 2, 3, 4, 4} = {1, 2, 3, 4}. It has 4 distinct elements so a(2) = 4.

%t Length /@ NestList[DeleteDuplicates[Flatten[Table[With[{a = #[[k]], b = #[[;; k]]}, {a b, a + b}], {k, Length[#]}]]] &, {1}, 6]

%o (PARI) lista(nn) = {my(v = [1]); print1(#v, ", "); for (n=1, nn, v = setunion(setbinop((x,y)->(x+y), v), setbinop((x,y)->(x*y), v)); print1(#v, ", "););} \\ _Michel Marcus_, Apr 13 2022

%o (Python)

%o from math import prod

%o from itertools import combinations_with_replacement

%o from functools import lru_cache

%o @lru_cache(maxsize=None)

%o def A352969_set(n):

%o if n == 0:

%o return {1}

%o return set(sum(x) for x in combinations_with_replacement(A352969_set(n-1),2)) | set(prod(x) for x in combinations_with_replacement(A352969_set(n-1),2))

%o def A353969(n):

%o return len(A352969_set(n)) # _Chai Wah Wu_, Apr 15 2022

%Y Cf. A263995, A273525, A353535, A353536.

%K nonn,more,hard

%O 0,2

%A _Vladimir Reshetnikov_, Apr 12 2022

%E a(7) from _Thomas Scheuerle_, Apr 13 2022

%E a(7) corrected by _Chai Wah Wu_, Apr 15 2022