cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A278116 a(n) is the largest j such that A278115(n,k) strictly decreases for k=1..j.

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