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.

A342804 Number of solutions to 1 +-*/ 2 +-*/ 3 +-*/ ... +-*/ n = 0.

This page as a plain text file.
%I A342804 #52 Apr 04 2021 01:02:34
%S A342804 0,0,1,1,1,5,8,18,39,91,185,460,1051,2526,6280,15645,35516,93765,
%T A342804 225989,611503
%N A342804 Number of solutions to 1 +-*/ 2 +-*/ 3 +-*/ ... +-*/ n = 0.
%C A342804 Normal operator precedence is followed, so multiplication and division are performed before addition or subtraction, and each operator only acts on the following term, so 2 / 3 * 4 equals (2 / 3) * 4.
%C A342804 Unlike A058377, which uses only addition and subtraction, this sequence has solutions for all values of n >= 3.
%e A342804 a(3) = 1 as 1 + 2 - 3 = 0 is the only solution.
%e A342804 a(4) = 1 as 1 - 2 - 3 + 4 = 0 is the only solution.
%e A342804 a(5) = 1 as 1 * 2 - 3 - 4 + 5 = 0 is the only solution. This is the first term where a solution exists while no corresponding solution exists in A058377.
%e A342804 a(6) = 5. The solutions, all of which use multiplication or division, are
%e A342804          1 + 2 * 3 + 4 - 5 - 6 = 0,
%e A342804          1 - 2 + 3 * 4 - 5 - 6 = 0,
%e A342804          1 - 2 * 3 + 4 - 5 + 6 = 0,
%e A342804          1 * 2 + 3 - 4 + 5 - 6 = 0,
%e A342804          1 - 2 / 3 / 4 - 5 / 6 = 0.
%e A342804   The last solution is the first that uses division.
%e A342804 a(7) = 8. Six solutions use just addition, division and multiplication. The other two are
%e A342804          1 + 2 - 3 * 4 * 5 / 6 + 7 = 0,
%e A342804          1 / 2 * 3 * 4 - 5 + 6 - 7 = 0.
%e A342804 a(15) = 6280. An example solution is
%e A342804          1 / 2 / 3 / 4 * 5 * 6 - 7 - 8 + 9 / 10 + 11 / 12 * 13 + 14 / 15 = 0
%e A342804   which includes four fractions that sum to 15, which is balanced by - 7 - 8.
%e A342804 a(20) = 611503. An example solution is
%e A342804          1 / 2 / 3 / 4 / 5 + 6 / 7 / 8 / 9 / 10 * 11 / 12 - 13 / 14 / 15 / 16
%e A342804               + 17 / 18 - 19 / 20 = 0
%e A342804   which sums five fractions that include fourteen divisions.
%t A342804 Table[Length@Select[Tuples[{"+","-","*","/"},k-1],ToExpression[""<>Riffle[ToString/@Range@k,#]]==0&],{k,9}] (* _Giorgos Kalogeropoulos_, Apr 02 2021 *)
%o A342804 (Python)
%o A342804 from itertools import product
%o A342804 from fractions import Fraction
%o A342804 def a(n):
%o A342804   nn = ["Fraction("+str(i)+", 1)" for i in range(1, n+1)]
%o A342804   return sum(eval("".join([*sum(zip(nn, ops+("",)), ())])) == 0 for ops in product("+-*/", repeat=n-1))
%o A342804 print([a(n) for n in range(1, 10)]) # _Michael S. Branicky_, Apr 02 2021
%Y A342804 Cf. A342602 (using +-*), A342995 (using +-/), A058377 (using +-), A063865, A000217, A025591, A161943.
%K A342804 nonn,more
%O A342804 1,6
%A A342804 _Scott R. Shannon_, Mar 27 2021