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.

A318271 The optimum crossing time for the Bridge and Torch problem, given that the crossing times for the group's members are given by the n-th partition in A026791.

This page as a plain text file.
%I A318271 #26 Sep 04 2023 10:59:45
%S A318271 1,1,2,3,2,3,5,4,3,2,4,7,6,5,5,4,3,5,9,8,7,6,6,6,5,6,4,3,6,11,10,9,8,
%T A318271 8,7,7,8,7,7,6,7,5,4,7,13,12,11,10,10,9,9,9,8,7,8,9,8,8,7,10,8,8,6,5,
%U A318271 4,8,15,14,13,12,12,11,11,11,10,9,10,10,9,8,9
%N A318271 The optimum crossing time for the Bridge and Torch problem, given that the crossing times for the group's members are given by the n-th partition in A026791.
%H A318271 User baseman101, <a href="https://codegolf.stackexchange.com/q/75615/53884">The Bridge and Torch Problem</a>, Programming Puzzles & Code Golf Stack Exchange.
%H A318271 Wikipedia, <a href="https://en.wikipedia.org/wiki/Bridge_and_torch_problem">Bridge and torch problem</a>.
%e A318271 When the crossing times are [1,2,5,10], the minimum total time for the group to cross is 17 minutes:
%e A318271   (2m)  1 and 2 cross,
%e A318271   (1m)  1 returns,
%e A318271   (10m) 5 and 10 cross,
%e A318271   (2m)  2 returns,
%e A318271   (2m)  1 and 2 cross.
%e A318271 +----+--------------------+------+
%e A318271 |  n | Crossing times     | a(n) |
%e A318271 +----+--------------------+------+
%e A318271 |  1 | [1]                |  1   |
%e A318271 |  2 | [1, 1]             |  1   |
%e A318271 |  3 | [2]                |  2   |
%e A318271 |  4 | [1, 1, 1]          |  3   |
%e A318271 |  5 | [1, 2]             |  2   |
%e A318271 |  6 | [3]                |  3   |
%e A318271 |  7 | [1, 1, 1, 1]       |  5   |
%e A318271 |  8 | [1, 1, 2]          |  4   |
%e A318271 |  9 | [1, 3]             |  3   |
%e A318271 | 10 | [2, 2]             |  2   |
%e A318271 | 11 | [4]                |  4   |
%e A318271 | 12 | [1, 1, 1, 1, 1]    |  7   |
%e A318271 | 13 | [1, 1, 1, 2]       |  6   |
%e A318271 | 14 | [1, 1, 3]          |  5   |
%e A318271 | 15 | [1, 2, 2]          |  5   |
%e A318271 | 16 | [1, 4]             |  4   |
%e A318271 | 17 | [2, 3]             |  3   |
%e A318271 | 18 | [5]                |  5   |
%e A318271 | 19 | [1, 1, 1, 1, 1, 1] |  9   |
%e A318271 | 20 | [1, 1, 1, 1, 2]    |  8   |
%e A318271 | 21 | [1, 1, 1, 3]       |  7   |
%e A318271 | 22 | [1, 1, 2, 2]       |  6   |
%e A318271 | 23 | [1, 1, 4]          |  6   |
%e A318271 | 24 | [1, 2, 3]          |  6   |
%e A318271 | 25 | [1, 5]             |  5   |
%e A318271 | 26 | [2, 2, 2]          |  6   |
%e A318271 | 27 | [2, 4]             |  4   |
%e A318271 | 28 | [3, 3]             |  3   |
%e A318271 | 29 | [6]                |  6   |
%e A318271 +----+--------------------+------+
%o A318271 (Julia)
%o A318271 function BT(p)
%o A318271     n = length(p)
%o A318271     p[end] = -(sum(p) + (n > 2 ? (n-3) * p[1] : 0))
%o A318271     if n >= 3
%o A318271         q = 2p[2] - p[1]; tog = false
%o A318271         for k in n-1:-1:1
%o A318271             (tog = ~tog) && p[k] > q ? p[k] -= q : p[k] = 0
%o A318271         end
%o A318271     end
%o A318271 -sum(p) end
%o A318271 [BT(p) for n in 1:9 for p in A026791(n)] |> println # _Peter Luschny_, Oct 18 2019
%Y A318271 Cf. A026791, A078476.
%K A318271 nonn,nice
%O A318271 1,3
%A A318271 _Peter Kagey_, Aug 22 2018
%E A318271 Terms a(45) and beyond added using Erwan's program from CodeGolf StackExchange by _Andrey Zabolotskiy_, Oct 18 2019