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.

A349544 Smallest possible value of |Sum_{k=0..n} (+-) 2^k * 3^(n-k)|, where each (+-) can be either plus or minus sign, independently for each term in the sum.

Original entry on oeis.org

1, 1, 1, 5, 1, 19, 7, 5, 65, 61, 73, 227, 257, 5, 439, 1253, 2425, 2035, 833, 2677, 10591, 6509, 32071, 41173, 77263, 114323, 18145, 129685, 321151, 15757, 645449, 113957, 50735, 477653, 24295, 5089013, 3743881, 4809115, 12209455, 8216179, 32894927, 80299843, 45673913
Offset: 0

Views

Author

Vladimir Reshetnikov, Nov 21 2021

Keywords

Comments

All terms are positive odd integers.

Examples

			For n = 3, there are 2^3 = 8 possible choices of signs: 3^3 + 2*3^2 + 2^2*3 + 2^3 = 65, 3^3 + 2*3^2 + 2^2*3 - 2^3 = 49, 3^3 + 2*3^2 - 2^2*3 + 2^3 = 41, 3^3 + 2*3^2 - 2^2*3 - 2^3 = 25, 3^3 - 2*3^2 + 2^2*3 + 2^3 = 29, 3^3 - 2*3^2 + 2^2*3 - 2^3 = 13, 3^3 - 2*3^2 - 2^2*3 + 2^3 = 5, and 3^3 - 2*3^2 - 2^2*3 - 2^3 = -11. The smallest absolute value is 5, so a(3) = 5.
		

Crossrefs

Programs

  • Maple
    b:= proc(k, n) option remember; `if`(k<0, {0}, map(x->
         (t-> [x+t, abs(x-t)][])(2^(n-k)*3^k), b(k-1, n)))
        end:
    a:= n-> min(b(n$2)):
    seq(a(n), n=0..18);  # Alois P. Heinz, Nov 21 2021
  • Mathematica
    Min@*Abs/@FoldList[Join[3 #1 + 2^#2, 3 #1 - 2^#2] &, {1}, Range[25]]
  • Python
    def f(k,n):
        if k == 0 and n == 0: return (x for x in (1,))
        if k < n: return (y*3 for y in f(k,n-1))
        return (abs(x+y) for x in f(k-1,n) for y in (2**n,-2**n))
    def A349544(n): return min(f(n,n)) # Chai Wah Wu, Nov 24 2021

Extensions

a(33)-a(35) from Chai Wah Wu, Nov 24 2021
a(36)-a(42) from Martin Ehrenstein, Nov 26 2021