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.

A358369 Euler transform of 2^floor(n/2), (A016116).

This page as a plain text file.
%I A358369 #10 Nov 18 2022 18:17:26
%S A358369 1,1,3,5,12,20,43,73,146,250,475,813,1499,2555,4592,7800,13761,23253,
%T A358369 40421,67963,116723,195291,332026,552882,932023,1544943,2585243,
%U A358369 4267081,7094593,11662769,19281018,31575874,51937608,84753396,138772038,225693778,368017636
%N A358369 Euler transform of 2^floor(n/2), (A016116).
%p A358369 BinaryRecurrenceSequence := proc(b, c, u0:=0, u1:=1) local u;
%p A358369 u := proc(n) option remember; if n < 2 then return [u0, u1][n + 1] fi;
%p A358369 b*u(n - 1) + c*u(n - 2) end; u end:
%p A358369 EulerTransform := proc(a) local b;
%p A358369 b := proc(n) option remember; if n = 0 then return 1 fi; add(add(d * a(d),
%p A358369 d = NumberTheory:-Divisors(j)) * b(n-j), j = 1..n) / n end; b end:
%p A358369 a := EulerTransform(BinaryRecurrenceSequence(0, 2, 1)): seq(a(n), n=0..36);
%o A358369 (Sage) # uses[EulerTransform from A166861]
%o A358369 b = BinaryRecurrenceSequence(0, 2, 1)
%o A358369 a = EulerTransform(b)
%o A358369 print([a(n) for n in range(37)])
%o A358369 (Python)
%o A358369 from typing import Callable
%o A358369 from functools import cache
%o A358369 from sympy import divisors
%o A358369 def BinaryRecurrenceSequence(b:int, c:int, u0:int=0, u1:int=1) -> Callable:
%o A358369     @cache
%o A358369     def u(n: int) -> int:
%o A358369         if n < 2:
%o A358369             return [u0, u1][n]
%o A358369         return b * u(n - 1) + c * u(n - 2)
%o A358369     return u
%o A358369 def EulerTransform(a: Callable) -> Callable:
%o A358369     @cache
%o A358369     def b(n: int) -> int:
%o A358369         if n == 0:
%o A358369             return 1
%o A358369         s = sum(sum(d * a(d) for d in divisors(j)) * b(n - j)
%o A358369             for j in range(1, n + 1))
%o A358369         return s // n
%o A358369     return b
%o A358369 b = BinaryRecurrenceSequence(0, 2, 1)
%o A358369 a = EulerTransform(b)
%o A358369 print([a(n) for n in range(37)])
%Y A358369 Cf. A002513, A016116.
%Y A358369 Sequences that can be represented as a EulerTransform(BinaryRecurrenceSequence()) include A000009, A000041, A000712, A001970, A002513, A010054, A015128, A022567, A034691, A111317, A111335, A117410, A156224, A166861, A200544, A261031, A261329, A358449.
%K A358369 nonn
%O A358369 0,3
%A A358369 _Peter Luschny_, Nov 17 2022