%I #14 Sep 08 2022 08:46:17
%S 1,2,3,3,4,3,2,2,5,4,4,2,2,3,3,5,3,2,2,4,3,3,2,2,3,4,6,6,2,3,4,3,3,2,
%T 2,3,5,4,4,2,4,3,4,3,2,2,3,4,3,2,2,4,3,4,3,2,2,3,4,3,2,2,3,3,5,3,2,2,
%U 4,5,4,2,2,3,3,4,3,2,3,4,7,5,2,2,3,4,2,2,2,3,5,5,5,2,2,3,4,3,2,2,4,5,3,3,2
%N a(n) is the largest j such that A278115(n,k) strictly decreases for k=1..j.
%H Jason Kimberley, <a href="/A278116/b278116.txt">Table of n, a(n) for n = 1..100000</a>
%t Map[1 + Length@ TakeWhile[Differences@ #, # < 0 &] &, #] &@ Table[# Floor[n Sqrt[2/#]]^2 &@ Prime@ k, {n, 105}, {k, PrimePi[2 n^2]}] (* _Michael De Vlieger_, Feb 17 2017 *)
%o (Magma)
%o A:=func<n,k|Isqrt(2*n^2 div k)^2*k>;
%o A278116:=func<n|(exists(j){j:j in[1..#P-1]|A(n,P[j])le A278115(n,P[j+1])}
%o select j else #P) where P is PrimesUpTo(2*n^2)>;
%o [A278116(n):n in[1..103]];
%o (Python)
%o def isqrt(n):
%o if n < 0:
%o raise ValueError('imaginary')
%o if n == 0:
%o return 0
%o a, b = divmod(n.bit_length(),2)
%o x = 2**(a+b)
%o while True:
%o y = (x + n//x)//2
%o if y >= x:
%o return x
%o x = y;
%o def next_prime(n):
%o for p in range(n+1,2*n+1):
%o for i in range(2,isqrt(n)+1):
%o if p % i == 0:
%o break
%o else:
%o return p
%o return None
%o def A278116(n):
%o k = 0
%o p = 2
%o s2= (n**2)*p
%o s = s2
%o while True:
%o s_= s
%o k+= 1
%o p = next_prime(p)
%o s = (isqrt(s2//p)**2)*p
%o if s > s_:
%o break
%o return k
%Y Cf. A278102.
%Y This is the row length sequence for triangles A278117 and A278118.
%Y A278119 lists first occurrences in this sequence.
%K nonn,easy
%O 1,2
%A _Jason Kimberley_, Feb 12 2017