Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #11 Mar 07 2018 15:58:12
%S 0,0,2,2,0,0,3,0,0,0,0,3,3,0,0,0,0,0,3,0,3,0,0,0,0,0,3,3,0,0,5,0,0,0,
%T 0,0,3,0,3,0,0,0,3,0,0,0,0,3,3,0,0,3,0,0,0,0,3,0,0,0,3,0,3,0,0,0,3,0,
%U 0,0,0,0,3,0,3,3,0,0,3,5,0,0,0,3,0,0,0,0,0,0,3,0,3,0,0,0,3,0,0,0,0,0,3,0,0,0,0,3,3,0,3,3,0,0,0,0,3,0,0,0,5
%N a(n) = max{ p prime | n = Sum_{j in 0:p-1} x^j*y^(p-j-1)} where x and y are positive integers with max(x, y) >= 2 or 0 if no such representation exists.
%C All prime numbers appear as values. The earliest appearance of the prime p has the index 2^p - 1 (Mersenne number).
%C The indices of the nonzero values are in A300332.
%H Peter Luschny, <a href="/A300333/b300333.txt">Table of n, a(n) for n = 1..10000</a>
%H Étienne Fouvry, Claude Levesque, Michel Waldschmidt, <a href="https://arxiv.org/abs/1712.09019">Representation of integers by cyclotomic binary forms</a>, arXiv:1712.09019 [math.NT], 2017.
%e Let f(x,y) = y^2 + x*y + x^2, g(x,y) = y^6 + x*y^5 + x^2*y^4 + x^3*y^3 + x^4*y^2 + x^5*y + x^6 and h(x,y) = Sum_{j in 0:10} x^j*y^(10-j). Then
%e a(49) = 3 because 49 = f(5, 3).
%e a(217) = 3 because 217 = f(13, 3).
%e a(448) = 7 because 448 = g(2, 2).
%e a(2047) = 11 because 2047 = h(2, 1).
%o (Julia)
%o using Primes, Nemo
%o function A300333(n)
%o R, z = PolynomialRing(ZZ, "z")
%o N = QQ(n)
%o # Bounds from Fouvry & Levesque & Waldschmidt
%o logn = log(n)^1.161
%o K = Int(floor(5.383*logn))
%o M = Int(floor(2*(n/3)^(1/2)))
%o k, p = 2, 0
%o while k <= K
%o if k == 7
%o K = Int(ceil(4.864*logn))
%o M = Int(ceil(2*(n/11)^(1/4)))
%o end
%o e = Int(eulerphi(ZZ(k)))
%o c = cyclotomic(k, z)
%o for y in 2:M, x in 1:y
%o N == y^e*subst(c, QQ(x,y)) && (p = k)
%o end
%o k = nextprime(k+1)
%o end
%o return p
%o end
%o A300333list(upto) = [A300333(n) for n in 1:upto]
%o println(A300333list(121))
%Y Cf. A300332, A001348.
%K nonn
%O 1,3
%A _Peter Luschny_, Mar 03 2018