%I #25 Dec 30 2023 16:21:21
%S 1,2,4,9,25,49,121,143,169,221,289,323,361,391,437,529,667,713,841,
%T 899,961,1073,1147,1271,1333,1369,1517,1591,1681,1739,1763,1849,1927,
%U 2021,2173,2209,2279,2491,2537,2773,2809,2867,3127,3233,3481,3551,3599,3721,3763
%N Numbers k such that 2*(Bacher(k) - sigma(k)) + k + 1 > 0.
%C We can use the Bacher numbers A368207 to measure the primeness of a positive integer, similar to how the number of prime factors of an integer does, but based on the number of representations of n as w*x + y*z with max(w, x) < min(y, z). Taking b(n) = 2*(Bacher(n) - sigma(n)) + n + 1 as the measure, Bacher's theorem shows that b(n) = 0 if n is an odd prime. Conversely, if b(n) = 0, we cannot conclude that n is prime as the example n = 35 shows, but this is probably the only exception.
%C This sequence gives the integers k for which b(k) is positive, and A368459 provides those for which b(k) is negative.
%C Apart from the first three terms, all terms are apparently odd semiprimes (A046315); they are odd composite numbers that cannot be divided by smaller composite numbers.
%H Peter Luschny, <a href="/A368458/b368458.txt">Table of n, a(n) for n = 1..1000</a>
%H Roland Bacher, <a href="https://doi.org/10.1080/00029890.2023.2242034">A quixotic proof of Fermat's two squares theorem for prime numbers</a>, American Mathematical Monthly, Vol. 130, No. 9 (November 2023), 824-836; <a href="https://arxiv.org/abs/2210.07657">arXiv version</a>, arXiv:2210.07657 [math.NT], 2022.
%F k is term <=> A368457(k) > 0 <=> 2*(A368207(k) - A000203(k)) + k + 1 > 0.
%e To zoom into the internal order of the terms, the sequence can also be written as an irregular triangle (for n >= 3). It starts:
%e 4;
%e 9;
%e 25;
%e 49;
%e 121, 143;
%e 169, 221;
%e 289, 323;
%e 361, 391, 437;
%e 529, 667, 713;
%e 841, 899;
%e 961, 1073, 1147, 1271, 1333;
%e 1369, 1517, 1591;
%e 1681, 1739, 1763,
%e 1849, 1927, 2021, 2173;
%e A row contains the terms between consecutive squares of primes, p^2 included and p'^2 excluded. The first column is the squares of primes A001248. The length of the rows is A368460.
%o (SageMath)
%o from itertools import islice
%o def A368207(n):
%o def t(n): return (d for d in divisors(n) if d*d <= n)
%o def s(d): return 2*d - 1 if d*d == n else 4*d - 2
%o def c(y, w, wx): return max(1, 2*((w*w < wx) + (y*y < n - wx)))
%o return sum((sum(sum((c(y, w, wx) for y in t(n-wx) if wx < y*w), start=0)
%o for w in t(wx)) for wx in range(1, n//2)),
%o start=sum(s(d) for d in t(n)))
%o def A368457(n): return 2 * (A368207(n) - sigma(n)) + n + 1
%o def isA368458(n): return 0 < A368457(n)
%o def A368458Gen(n):
%o while True:
%o if isA368458(n): yield n
%o n += 1
%o def A368458List(start, size): return list(islice(A368458Gen(start), size))
%o print(A368458List(1, 20))
%o (Julia)
%o using Nemo
%o function A368458List(slicenum::Int)
%o results = [Int[] for _ in 1:slicenum + 1]
%o slicelen = 1000
%o Threads.@threads for sl in 1:slicenum
%o first = (sl - 1) * slicelen + 1
%o last = first + slicelen - 1
%o result = results[sl]
%o for n in first:2:last
%o rem(n, 5) == 0 && continue
%o if 2 * (divisor_sigma(n, 1) - A368207(n)) < n + 1
%o push!(result, n)
%o end end end
%o results[slicenum + 1] = [2, 4, 25]
%o sort(reduce(vcat, results))
%o end
%o print(A368458List(5)) # returns values up to param * 1000
%Y Cf. A000203, A046315, A001248, A368207, A368457, A368459, A368460.
%K nonn
%O 1,2
%A _Peter Luschny_, Dec 26 2023