login
Distance between first appearance and last appearance of n in A105224, counting both end points.
1

%I #37 Sep 29 2021 00:07:53

%S 17,33,60,67,102,103,144,162,186,204,187,246,264,288,306,273,348,307,

%T 390,408,432,450,393,492,510,534,552,477,594,513,636,654,678,696,597,

%U 738,756,780,798,683,840,858,882,900

%N Distance between first appearance and last appearance of n in A105224, counting both end points.

%C When the sequence A105224 is plotted, we get horizontal lines which lie roughly on a parabola and correspond to repeated values in the sequence. This sequence is the length of these lines.

%C Empirically, all elements seem to roughly lie on either of the lines 20.5*n or 17*n.

%H Elvar Wang Atlason, <a href="/A346528/b346528.txt">Table of n, a(n) for n = 1..5000</a>

%F a(n) = A346527(n) - A346522(n) + 1.

%e For n = 1, the number 1 appears in the sequence A105224 at indices ranging from 1 to 17. This is because the intervals [1,2] and [17,34] each contain 1 square, and are the smallest and largest intervals, respectively, of the form [k,2*k] that contain exactly 1 square. So a(1) = 17.

%o (Python)

%o k = 1

%o n = 1

%o while n<100:

%o if math.isqrt(2*k)-math.isqrt(k-1) == n:

%o k1 = k

%o t = k

%o k2 = k

%o while t < 6*(n+1)**2:

%o if math.isqrt(2*t)-math.isqrt(t-1) == n:

%o k2 = t

%o t = t+1

%o n = n+1

%o print(k2-k1+1)

%o k = k+1

%o (Python)

%o from math import isqrt

%o def A346528(n):

%o if n == 1: return 17

%o a, b, k, k2, m, r, s = -6*(n+1)**2, (n+1)**4, 2, 4, 1, 0, 0

%o while 2*m+a < 0 or m*(m+a)+b < 0:

%o if isqrt(2*m) - isqrt(m-1) == n:

%o r = m

%o if s == 0 and isqrt(2*m+2)-isqrt(m) == n:

%o s = m

%o k += 1

%o k2 += 2*k-1

%o m = (k2-1)//2

%o return r-s # _Chai Wah Wu_, Sep 28 2021

%Y Cf. A105224, A346527, A346522.

%K easy,nonn

%O 1,1

%A _Hrólfur Eyjólfsson_, _Elvar Wang Atlason_, Jul 22 2021