login
A393260
Number of distinct results from equations consisting of n copies of the number n and one of the four basic arithmetic operations {+, -, *, /} between each pair with multiplication and division taking precedence over addition and subtraction.
0
1, 3, 11, 24, 62, 121, 263, 483, 947, 1662, 3037, 5140, 8925, 14665, 24485, 39228, 63486, 99536, 156992, 241528, 372802, 564052, 854612, 1273931, 1899229, 2793495, 4105711, 5966247, 8658135, 12443736, 17852950, 25401161, 36067345, 50842332, 71512303, 99946170
OFFSET
1,2
COMMENTS
Multiplication and division share the same precedence level, followed by addition and subtraction at the same level. Within each precedence level, evaluation is from left to right. No parentheses are allowed.
FORMULA
2*n-1 <= a(n) <= 4^(n-1), arising from the number of expressing with just addition or subtraction and the number with duplicates counted, respectively.
EXAMPLE
For n=1: 1 is the only expression with value 1.
For n=2: 2+2=4, 2-2=0, 2*2=4 (not new), 2/2=1; a total of 3 distinct values.
For n=3: 3+3+3=9, 3+3-3=3, 3+3*3=12, 3+3/3=4, 3-3+3=3 (not new), 3-3-3=-3, 3-3*3=-6, 3-3/3=2, 3*3+3=12 (not new), 3*3-3=6, 3*3*3=27, 3*3/3=3 (not new), 3/3+3=4 (not new), 3/3-3=-2, 3/3*3=3 (not new), 3/3/3=1/3; a total of 11 distinct values.
PROG
(Python)
from gmpy2 import mpq
from itertools import product
def a(n):
if n == 1: return 1
s = f"mpq({n}, 1)"
return len(set(eval(s+s.join(p)+s) for p in product("+-*/", repeat=n-1)))
print([a(n) for n in range(1, 11)]) # Michael S. Branicky, Jun 19 2026
(Python) # see Links for a faster implementation
CROSSREFS
Sequence in context: A294415 A141595 A112051 * A231068 A185258 A118436
KEYWORD
nonn,new
AUTHOR
Axel Prunier, Mar 09 2026
EXTENSIONS
a(5)-a(15) corrected by Sean A. Irvine, May 26 2026
a(16)-a(30) from Michael S. Branicky, Jun 20 2026
a(31)-a(35) from Michael S. Branicky, Jun 24 2026
a(36) from Michael S. Branicky, Jul 03 2026
STATUS
approved