login
A318358
a(1) = 2; for n > 1, a(n) is the least positive number not yet in the sequence such that Sum_{k=1..n} a(k) divides Sum_{k=1..n} a(k)^2.
2
2, 6, 5, 13, 9, 20, 30, 19, 52, 78, 18, 7, 43, 151, 79, 126, 88, 373, 183, 84, 177, 521, 263, 2347, 1305, 392, 294, 1207, 3946, 1973, 2099, 185, 999, 518, 1970, 9791, 4577, 6111, 4811, 21372, 10154, 3210, 9874, 89482, 49678, 9918, 8344, 46684, 65588, 50136
OFFSET
1,1
COMMENTS
Is this sequence infinite?
The variant of this sequence starting with 1 has only one term.
See A318359 for a similar sequence.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..250 (n = 1..100 from Rémy Sigrist)
EXAMPLE
For n = 3:
- (2^2 + 6^2 + 1^2) == 5 mod (2 + 6 + 1),
- (2^2 + 6^2 + 3^2) == 5 mod (2 + 6 + 3),
- (2^2 + 6^2 + 4^2) == 8 mod (2 + 6 + 4),
- (2^2 + 6^2 + 5^2) == 0 mod (2 + 6 + 5),
- hence a(3) = 5.
PROG
(PARI) s=0; s2=0; p=0; v=2; for (n=1, 50, print1 (v ", "); s+=v; s2+=v^2; p+=2^v; for (w=1, oo, if (!bittest(p, w) && (s2+w^2)%(s+w)==0, v=w; break)))
(Python)
import bisect
from sympy.solvers.diophantine import diop_quadratic
from sympy.abc import x, y
A318358_list, A318358_set, p, q = [2], {2}, 2, 2**2
for _ in range(100):
r = sorted(next(zip(*diop_quadratic(x**2+q-p*y-x*y))))
for a in r[bisect.bisect_right(r, 0):]:
if a not in A318358_set:
A318358_list.append(a)
A318358_set.add(a)
break
p += a
q += a**2 # Chai Wah Wu, Aug 28 2018
CROSSREFS
Cf. A318359.
Sequence in context: A179627 A193977 A092313 * A230383 A009460 A085205
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Aug 24 2018
STATUS
approved