A352969 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.
1, 2, 4, 11, 52, 678, 67144, 357306081
Offset: 0
Examples
After the 1st step the set becomes {1*1, 1+1} = {1, 2}. It has 2 distinct elements so a(1) = 2. 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.
Programs
-
Mathematica
Length /@ NestList[DeleteDuplicates[Flatten[Table[With[{a = #[[k]], b = #[[;; k]]}, {a b, a + b}], {k, Length[#]}]]] &, {1}, 6]
-
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
-
Python
from math import prod from itertools import combinations_with_replacement from functools import lru_cache @lru_cache(maxsize=None) def A352969_set(n): if n == 0: return {1} 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)) def A353969(n): return len(A352969_set(n)) # Chai Wah Wu, Apr 15 2022
Extensions
a(7) from Thomas Scheuerle, Apr 13 2022
a(7) corrected by Chai Wah Wu, Apr 15 2022