|
|
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.
|
|
2
|
|
|
|
OFFSET
|
0,2
|
|
LINKS
|
|
|
EXAMPLE
|
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.
|
|
MATHEMATICA
|
Length /@ NestList[DeleteDuplicates[Flatten[Table[With[{a = #[[k]], b = #[[;; k]]}, {a b, a + b}], {k, Length[#]}]]] &, {1}, 6]
|
|
PROG
|
(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)
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))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more,hard
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|