OFFSET
1,4
COMMENTS
A triple of integers (u,v,w) is a ternary triple if in the ternary expansions of u,v,w, all three disagree at the least significant position at which any two disagree.
Equivalently, (u,v,w) is a ternary triple if the highest power of three dividing 2w-u-v is greater than the highest power of three dividing gcd(w-u,w-v).
LINKS
Coen del Valle and Peter J. Dukes, Balancing permuted copies of multigraphs and integer matrices, arXiv:2201.00897 [math.CO], 2022.
EXAMPLE
For n = 7 the 13 ternary triples are (1, 2, 3), (2, 3, 4), (1, 3, 5), (3, 4, 5), (1, 2, 6), (2, 4, 6), (1, 5, 6), (4, 5, 6), (2, 3, 7), (1, 4, 7), (3, 5, 7), (2, 6, 7), (5, 6, 7).
MATHEMATICA
Array[Sum[Sum[Sum[Boole[IntegerExponent[w + w - u - v, 3] > IntegerExponent[GCD[w - u, w - v], 3]], {u, (v - 1)}], {v, 2, (w - 1)}], {w, 3, #}] &, 55] (* Michael De Vlieger, Feb 15 2022 *)
PROG
(PARI) A349216(n) = sum(w=3, n, sum(v=2, (w-1), sum(u=1, (v-1), valuation(w+w-u-v, 3) > valuation(gcd(w-u, w-v), 3)))); \\ Antti Karttunen, Nov 13 2021
(SageMath)
def a(n):
t=3^ceil(log(n, 3))
counter=0
for w in range(n):
for v in range(w):
for u in range(v):
if min(gcd(w-u, 3^t), gcd(w-v, 3^t))<gcd(2*w-u-v, 3^t):
counter+=1
return counter
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Peter J. Dukes, Nov 10 2021
STATUS
approved