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.

A123212 Let S(1) = {1} and, for n > 1, let S(n) be the smallest set containing x, 2x and x^2 for each element x in S(n-1). a(n) is the sum of the elements in S(n).

This page as a plain text file.
%I A123212 #21 Apr 22 2022 04:23:32
%S A123212 1,3,7,31,383,71679,4313284607,18447026747376402431,
%T A123212 340282367000167840050178713574329810943,
%U A123212 115792089237316195429848086745536112650120661123018741407845920610578123980799
%N A123212 Let S(1) = {1} and, for n > 1, let S(n) be the smallest set containing x, 2x and x^2 for each element x in S(n-1). a(n) is the sum of the elements in S(n).
%C A123212 If we take the cardinality of the set S(n) instead of the sum, we get the Fibonacci numbers 1,2,3,5,8,13,21,34,... If the set mapping uses x -> x, 2x and 3x instead of x -> x, 2x, and x^2, the corresponding sequence consists of the Stirling numbers of the second kind: 1, 6, 25, 90, 301, 966, 3025, ... (A000392).
%H A123212 Alois P. Heinz, <a href="/A123212/b123212.txt">Table of n, a(n) for n = 1..13</a>
%e A123212 Under the indicated set mapping we have {1} -> {1,2} -> {1,2,4} -> {1,2,4,8,16}, giving the sums a(1)=1, a(2)=3, a(3)=7, a(4)=31, etc.
%p A123212 s:= proc(n) option remember; `if`(n=1, 1,
%p A123212       map(x-> [x, 2*x, x^2][], {s(n-1)})[])
%p A123212     end:
%p A123212 a:= n-> add(i, i=s(n)):
%p A123212 seq(a(n), n=1..10);  # _Alois P. Heinz_, Jan 12 2022
%t A123212 S[n_] := S[n] = If[n == 1, {1}, {#, 2#, #^2}& /@ S[n-1] // Flatten // Union];
%t A123212 a[n_] := S[n] // Total;
%t A123212 Table[a[n], {n, 1, 10}] (* _Jean-François Alcover_, Apr 22 2022 *)
%o A123212 (Python)
%o A123212 from itertools import chain, islice
%o A123212 def A123212_gen(): # generator of terms
%o A123212     s = {1}
%o A123212     while True:
%o A123212         yield sum(s)
%o A123212         s = set(chain.from_iterable((x,2*x,x**2) for x in s))
%o A123212 A123212_list = list(islice(A123212_gen(),10)) # _Chai Wah Wu_, Jan 12 2022
%Y A123212 Cf. A000045, A000392, A122554.
%K A123212 nonn
%O A123212 1,2
%A A123212 _John W. Layman_, Oct 05 2006