OFFSET
1,1
COMMENTS
LINKS
Ctibor O. Zizka, Table of k < 10^9, Terms 38..45 from David A. Corneth.
A. Behera and G. K. Panda, On the square roots of triangular numbers, The Fibonacci Quarterly, 37.2 (1999), 98-105.
EXAMPLE
k = 3:
phi(1) + phi(2) = phi(4) = 2.
Thus the balancing number k = 3 is a term. The balancer r is 1.
k = 4:
phi(1) + phi(2) + phi(3) = phi(5) = 4.
Thus the balancing number k = 4 is a term. The balancer r is 1.
phi(i) = A000010(i).
MATHEMATICA
With[{m = 30000}, phi = EulerPhi[Range[m]]; s = Accumulate[phi]; Select[Range[2, m], MemberQ[s, 2*s[[#]] - phi[[#]]] &]] (* Amiram Eldar, Dec 07 2022 *)
PROG
(Python)
from sympy import totient as phi
from itertools import count, islice
def f(n): # function we wish to "balance"
return phi(n)
def agen(): # generator of terms
s, sset, i = [0, f(1), f(1)+f(2)], set(), 3
for k in count(2):
target = s[k-1] + s[k]
while s[-1] < target:
fi = f(i); nexts = s[-1] + fi; i += 1
s.append(nexts); sset.add(nexts)
if target in sset: yield k
print(list(islice(agen(), 17))) # Michael S. Branicky, Dec 07 2022
(PARI) upto(n) = {my(res = List(), lefttotal = 1, righttotal = 2, k = 2, nplusr = 3, sumf = 1, oldfk = 1); for(i = 1, n, while(lefttotal > righttotal, nplusr++; righttotal+=f(nplusr) ); if(lefttotal == righttotal, listput(res, k)); lefttotal+=oldfk; k++; fk = f(k); righttotal-=fk; oldfk = fk ); res }
f(k) = eulerphi(k) \\ David A. Corneth, Dec 07 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Ctibor O. Zizka, Dec 07 2022
EXTENSIONS
a(8)-a(15) from Amiram Eldar, Dec 07 2022
a(16)-a(37) from Michael S. Branicky, Dec 07 2022
STATUS
approved