cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

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.

Original entry on oeis.org

1, 2, 4, 11, 52, 678, 67144, 357306081
Offset: 0

Views

Author

Vladimir Reshetnikov, Apr 12 2022

Keywords

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.
		

Crossrefs

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

A353536 a(n) is the cardinality of the set S(n) obtained by the following process: Start with the set S(0) = {i}, where i is the imaginary unit. In step n, the set S(n) is the union of all Gaussian integers obtained by the m*(m+1)/2 sums and the m*(m+1)/2 products formed with the pairs of numbers in the Cartesian product S(n-1) x S(n-1) with m = card(S(n-1)).

Original entry on oeis.org

1, 2, 6, 34, 458, 41846, 169022181
Offset: 0

Views

Author

Hugo Pfoertner, Apr 26 2022

Keywords

Examples

			S(0) = {i}, a(0) = 1;
S(1) = {-1, 2*i}, a(1) = 2;
S(2) = {-4, -2, 1, -1+2*i, -2*i, 4*i}, a(2) = 6;
S(3) = {-16, -8, -6, -4, -3, -2, -1, 1, 2, 4, 8, 16, -8-4*i, -5+2*i, -4-2*i, -4+4*i, -3-4*i, -3+2*i, -2-2*i, -2+4*i, -1+2*i, -1+6*i, -16*i, -8*i, -4*i, -2*i, 2*i, 4*i, 8*i, 1-2*i, 1+4*i, 2-4*i, 4-8*i, 4+2*i}, a(3) = 34.
		

Crossrefs

Programs

  • PARI
    a353536(nmax) = {my(v=[I],m=#v); print1(m,", "); for(n=1,nmax, my(L=m*(m+1), w=vector(L), k=0); for(i=1,#v, for(j=i,#v, w[k++]=v[i]+v[j]; w[k++]=v[i]*v[j])); v=Set(w); m=#v; print1(m,", "))};
    a353536(5)
Showing 1-2 of 2 results.