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.

Showing 1-10 of 12 results. Next

A368457 a(n) = 2*(Bacher(n) - sigma(n)) + n + 1 = 2*(A368207(n) - A000203(n)) + n + 1.

Original entry on oeis.org

2, 1, 0, 1, 0, -1, 0, -5, 2, -7, 0, -7, 0, -9, -4, -7, 0, -19, 0, -9, -10, -13, 0, -27, 4, -15, -12, -23, 0, -25, 0, -29, -14, -19, 0, -43, 0, -21, -16, -41, 0, -33, 0, -39, -28, -25, 0, -59, 6, -41, -20, -45, 0, -53, -16, -39, -22, -31, 0, -99, 0, -33, -20
Offset: 1

Views

Author

Peter Luschny, Dec 26 2023

Keywords

Comments

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 where max(w, x) < min(y, z).
Bacher's theorem shows that a(n) = 0 if n is an odd prime. Conversely, if a(n) = 0, we cannot conclude that n is prime as the example n = 35 shows, but this is probably the only exception.
Of the first 32,000 terms, approximately 88% are less than 0, 11% are equal to 0, and 1% are greater than 0. A368458 gives the indices for which a(n) is positive, and A368459 those for which a(n) is negative.
It appears that a(p^2) = p - 1 (A006093) for all prime p, following the observation by Knuth that apparently A368207(p^2) = (p^2 + 3*p)/2.

Crossrefs

Programs

  • Julia
    using Nemo
    A368457(n) = 2 * (A368207(n) - divisor_sigma(n, 1)) + n + 1
    println([A368457(n) for n in 1:63])
  • Mathematica
    t[n_]:=t[n]=Select[Divisors[n], #^2<=n&];
    A368207[n_]:=Sum[(1+Boole[d^2A368457[n_]:=2(A368207[n]-DivisorSigma[1,n])+n+1;
    Array[A368457, 100] (* Paolo Xausa, Jan 02 2024 *)

A368341 Fixed points of A368207.

Original entry on oeis.org

0, 1, 2, 8, 9, 32, 128, 238, 512, 1012, 2048, 8192, 15070, 21658, 32768, 131072, 383548, 391612, 524288
Offset: 1

Views

Author

Chai Wah Wu, Dec 21 2023

Keywords

Comments

Numbers k such that A368207(k)=k.
Conjecture: 2^(2k+1) for k>=0 (A004171) are terms.

Crossrefs

Programs

  • Python
    from itertools import count, islice
    from sympy import divisors
    def A368341_gen(startvalue=0): # generator of terms >= startvalue
        for n in count(max(startvalue,0)):
            c = 0
            for d2 in divisors(n):
                if d2**2 > n:
                    break
                c += (d2<<2)-2 if d2**2n:
                    break
            if c<=n:
                for wx in range(1,(n>>1)+1):
                    for d1 in divisors(wx):
                        if d1**2 > wx:
                            break
                        for d2 in divisors(m:=n-wx):
                            if d2**2 > m:
                                break
                            if wx < d1*d2:
                                k = 1
                                if d1**2 != wx:
                                    k <<=1
                                if d2**2 != m:
                                    k <<=1
                                c+=k
                                if c>n:
                                    break
            if c==n:
                yield n
    A368341_list = list(islice(A368341_gen(),10))

Extensions

a(17)-a(19) from Chai Wah Wu, Dec 22 2023

A368496 Squarefree numbers k such that A368207(k^2) <> k+(sigma(k^2)-1)/2.

Original entry on oeis.org

30, 35, 42, 70, 105, 110, 130, 143, 154, 165, 182, 195, 210, 221, 238, 255, 266, 285, 286, 323, 330, 357, 374, 385, 390, 391, 399, 418, 429, 437, 442, 455, 462, 483, 494, 506, 510, 546, 570, 595, 598, 609, 638, 646, 663, 665, 667, 682, 690, 713, 714, 715, 754
Offset: 1

Views

Author

Chai Wah Wu, Dec 27 2023

Keywords

Comments

Sequence suggested by the observation that A368207(k^2) = k+(sigma(k^2)-1)/2 for many numbers k.

Crossrefs

A368276 Number of nonnegative representations of n = w*x + y*z with max(w, x) < min(y, z) and w <= x <= y <= z.

Original entry on oeis.org

1, 1, 1, 3, 2, 3, 2, 3, 5, 4, 3, 6, 4, 4, 5, 9, 4, 7, 5, 9, 6, 7, 4, 11, 11, 7, 7, 11, 7, 13, 7, 10, 9, 10, 9, 19, 9, 9, 10, 17, 9, 17, 8, 14, 14, 13, 7, 21, 17, 14, 13, 17, 10, 20, 13, 22, 14, 15, 10, 26, 14, 13, 18, 28, 15, 22, 13, 19, 17, 25, 12, 33, 15, 18
Offset: 1

Views

Author

Peter Luschny, Dec 19 2023

Keywords

Comments

Number of monotone Bacher representations (A368207) of n. We call a quadruple (w, x, y, z) of nonnegative integers a monotone Bacher representation of n if and only if n = w*x + y*z and w <= x < y <= z.

Examples

			For n = 13, the 4 solutions are (w, x, y, z) = (0, 0, 1, 13), (1, 1, 2, 6), (1, 1, 3, 4), (2, 2, 3, 3).
		

Crossrefs

Programs

  • Julia
    using Nemo
    function A368276(n)
        t(n) = (d for d in divisors(n) if d * d <= n)
        sum(sum(sum(1 for d in t(n - wx) if wx < d * dx; init=0)
                for dx in t(wx)) for wx in 1:div(n, 2); init=sum(t(n)))
    end
    println([A368276(n) for n in 1:74])  # Peter Luschny, Dec 19 2023
  • Mathematica
    t[n_]:=t[n]=Select[Divisors[n],#^2<=n&];
    A368276[n_]:=Total[t[n]]+Sum[Boole[wxA368276,100] (* Paolo Xausa, Jan 02 2024 *)
  • Python
    from itertools import takewhile
    from sympy import divisors
    def A368276(n):
        c = sum(takewhile(lambda x: x**2 <= n, divisors(n)))
        for wx in range(1, (n >> 1) + 1):
            for d1 in divisors(wx):
                if d1**2 > wx:
                    break
                m = n - wx
                c += sum(1
                    for d in takewhile(lambda x: x**2 <= m, divisors(n - wx))
                    if wx < d * d1)
        return c  # Chai Wah Wu, Dec 19 2023
    

A368458 Numbers k such that 2*(Bacher(k) - sigma(k)) + k + 1 > 0.

Original entry on oeis.org

1, 2, 4, 9, 25, 49, 121, 143, 169, 221, 289, 323, 361, 391, 437, 529, 667, 713, 841, 899, 961, 1073, 1147, 1271, 1333, 1369, 1517, 1591, 1681, 1739, 1763, 1849, 1927, 2021, 2173, 2209, 2279, 2491, 2537, 2773, 2809, 2867, 3127, 3233, 3481, 3551, 3599, 3721, 3763
Offset: 1

Views

Author

Peter Luschny, Dec 26 2023

Keywords

Comments

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.
This sequence gives the integers k for which b(k) is positive, and A368459 provides those for which b(k) is negative.
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.

Examples

			To zoom into the internal order of the terms, the sequence can also be written as an irregular triangle (for n >= 3). It starts:
      4;
      9;
     25;
     49;
    121,  143;
    169,  221;
    289,  323;
    361,  391, 437;
    529,  667, 713;
    841,  899;
    961, 1073, 1147, 1271, 1333;
   1369, 1517, 1591;
   1681, 1739, 1763,
   1849, 1927, 2021, 2173;
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.
		

Crossrefs

Programs

  • Julia
    using Nemo
    function A368458List(slicenum::Int)
        results = [Int[] for _ in 1:slicenum + 1]
        slicelen = 1000
        Threads.@threads for sl in 1:slicenum
            first = (sl - 1) * slicelen + 1
            last = first + slicelen - 1
            result = results[sl]
            for n in first:2:last
                rem(n, 5) == 0 && continue
                if 2 * (divisor_sigma(n, 1) - A368207(n)) < n + 1
                    push!(result, n)
        end end end
        results[slicenum + 1] = [2, 4, 25]
        sort(reduce(vcat, results))
    end
    print(A368458List(5)) # returns values up to param * 1000
  • SageMath
    from itertools import islice
    def A368207(n):
        def t(n): return (d for d in divisors(n) if d*d <= n)
        def s(d): return 2*d - 1 if d*d == n else 4*d - 2
        def c(y, w, wx): return max(1, 2*((w*w < wx) + (y*y < n - wx)))
        return sum((sum(sum((c(y, w, wx) for y in t(n-wx) if wx < y*w), start=0)
        for w in t(wx)) for wx in range(1, n//2)),
        start=sum(s(d) for d in t(n)))
    def A368457(n): return 2 * (A368207(n) - sigma(n)) + n + 1
    def isA368458(n): return 0 < A368457(n)
    def A368458Gen(n):
        while True:
            if isA368458(n): yield n
            n += 1
    def A368458List(start, size): return list(islice(A368458Gen(start), size))
    print(A368458List(1, 20))
    

Formula

k is a term <=> A368457(k) > 0 <=> 2*(A368207(k) - A000203(k)) + k + 1 > 0.

A368459 Numbers k such that 2*(Bacher(k) - sigma(k)) + k + 1 < 0.

Original entry on oeis.org

6, 8, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 26, 27, 28, 30, 32, 33, 34, 36, 38, 39, 40, 42, 44, 45, 46, 48, 50, 51, 52, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 69, 70, 72, 74, 75, 76, 77, 78, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95
Offset: 1

Views

Author

Peter Luschny, Dec 26 2023

Keywords

Comments

Complementary to A368458, this sequence lists the indices of negative values of A368457. See the comments in A368458.
In summary, A368458 U A368459 U Primes U {35, ...} decomposes the positive integers into disjoint sets, whereby the nature of the fourth set is currently unclear; probably, it has only 35 as a member.

Crossrefs

Programs

  • Julia
    println([n for n in 1:95 if A368457(n) < 0])

Formula

k is a term <=> A368457(k) < 0 <=> 2*(A368207(k) - A000203(k)) + k + 1 < 0.

A368460 a(n) = card(k: prime(n)^2 <= k < prime(n + 1)^2 and k term of A368458).

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 3, 3, 2, 5, 3, 3, 4, 5, 4, 3, 9, 5, 4, 7, 5, 6, 14, 6, 4, 7, 3, 5, 22, 6, 6, 4, 16, 5, 12, 12, 8, 15, 13, 5, 19, 5, 10, 4, 30, 26, 10, 6, 12, 11, 5, 28, 19, 15, 20, 8, 19, 9, 7, 22
Offset: 1

Views

Author

Peter Luschny, Dec 26 2023

Keywords

Comments

If A368458 is written as an irregular triangle for n >= 3, then a(n) is the length of row n.
Conjecture: For all n >= 5, there is at least one j such that b(j) = 2 * (Bacher(j) - sigma(j)) + j + 1 is > 0 and prime(n)^2 < b(j) < prime(n + 1)^2. In other words, a(n) > 1 for n >= 5.

Examples

			a(11) = 5 because 31^2 = 961, 1073, 1147, 1271, 1333, 1369 = 37^2 and all the terms are in that order in A368458.
		

Crossrefs

Cf. A000203, A001248, A050216 (Brocard's Conjecture), A368207 (Bacher), A368457, A368458.

Programs

  • SageMath
    # using A368207
    def A368460(n):
        pn = nth_prime(n); pn1 = nth_prime(n + 1)
        A368457 = lambda n: 2 * (A368207(n) - sigma(n)) + n + 1
        return sum(1 for n in range(pn ** 2, pn1 ** 2) if A368457(n) > 0)
    print([A368460(n) for n in range(1, 25)])

A368580 a(n) = Sum_{d|n and d^2 <= n} (1 + [d^2 < n]) * (2*d - 1), where [.] denote the Iverson brackets.

Original entry on oeis.org

1, 2, 2, 5, 2, 8, 2, 8, 7, 8, 2, 18, 2, 8, 12, 15, 2, 18, 2, 22, 12, 8, 2, 32, 11, 8, 12, 22, 2, 36, 2, 22, 12, 8, 20, 43, 2, 8, 12, 40, 2, 40, 2, 22, 30, 8, 2, 54, 15, 26, 12, 22, 2, 40, 20, 48, 12, 8, 2, 72, 2, 8, 38, 37, 20, 40, 2, 22, 12, 52, 2, 84, 2, 8
Offset: 1

Views

Author

Peter Luschny, Dec 31 2023

Keywords

Comments

A quadruple (w, x, y, z) of nonnegative integers is a 'Bacher representation' of n if and only if n = w*x + y*z and max(w,x) < min(y,z).
A Bacher representation is 'monotone' if additionally w <= x <= y <= z.
A Bacher representation is 'degenerated' if w = 0. The weight of a Bacher representation is defined as
W(w, x, y, z) = max(1, 2*([w < x] + [y < z])).
a(n) is the sum of the weights of all degenerated monotone Bacher representations of n. The complementary sum of weights of nondegenerated monotone Bacher representations is A368581.

Examples

			Below are the monotone Bacher representations of n = 27 listed.
  W(0, 0, 1, 27) = 2;
  W(0, 0, 3,  9) = 2;
  W(0, 1, 3,  9) = 4;
  W(0, 2, 3,  9) = 4;
  W(1, 1, 2, 13) = 2;
  W(1, 2, 5,  5) = 2;
  W(1, 3, 4,  6) = 4.
Thus a(27) = 2 + 2 + 4 + 4 = 12. Adding all weights gives A368207(27) = 20.
For instance, the integers n = 6, 8, and 12 have only degenerated Bacher representation, so for these cases, a(n) = A368207(n).
		

Crossrefs

Programs

  • Julia
    using Nemo
    function A368580(n)
        sum(d * d == n ? d * 2 - 1 : d * 4 - 2
        for d in (d for d in divisors(n) if d * d <= n))
    end
    println([A368580(n) for n in 1:74])
  • Mathematica
    A368580[n_]:=DivisorSum[n,(1+Boole[#^2A368580,100] (* Paolo Xausa, Jan 01 2024 *)

Formula

a(p) = 2 for all prime p.
a(n) is odd if and only if n is a square.
a(n) + A368581(n) = A368207(n).

A368581 The sum of weights of nondegenerated monotone Bacher representations of n.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 2, 0, 2, 1, 4, 0, 5, 4, 2, 4, 7, 2, 8, 5, 4, 10, 10, 2, 9, 13, 8, 8, 13, 8, 14, 10, 12, 19, 10, 8, 17, 22, 16, 9, 19, 18, 20, 20, 11, 28, 22, 16, 20, 21, 24, 27, 25, 26, 16, 24, 28, 37, 28, 16, 29, 40, 24, 34, 22, 34, 32, 41, 36, 28, 34, 28
Offset: 1

Views

Author

Peter Luschny, Dec 31 2023

Keywords

Comments

For the definition of 'Bacher representation' and related notions, see the comments in A368580.

Examples

			See the example in A368580.
		

Crossrefs

Programs

  • Julia
    using Nemo
    function A368581(n::Int)
        t(n) = (d for d in divisors(n) if d * d <= n)
        c(y, w, wx) = max(1, 2 * (Int(w * w < wx) + Int(y * y < n - wx)))
        sum(sum(sum(c(y, w, wx) for y in t(n - wx) if wx < y * w; init=0)
        for w in t(wx)) for wx in 1:div(n, 2); init=0)
    end
    println([A368581(n) for n in 1:72])
  • Mathematica
    t[n_]:=t[n]=Select[Divisors[n],#^2<=n&];
    A368581[n_]:=Sum[If[wxA368581,100] (* Paolo Xausa, Jan 02 2024 *)

Formula

a(n) = Sum_{k in K} Sum_{w in W} Sum_{y in Y} max(1, 2*([w^2 < k] + [y^2 < n - k])), where the square brackets denote Iverson brackets and k in K <=> 1 <= k <= floor(n/2), w in W <=> w|k and w^2 <= k, and y in Y <=> y|n-k and y^2 <= n-k and k < y*w. (See the Julia implementation.)
a(n) + A368580(n) = A368207(n).
a(p) = (p + 1) / 2 - 2 for all odd prime p.

A368277 Prime numbers that have an even number of monotone Bacher representations (A368276).

Original entry on oeis.org

5, 7, 13, 17, 23, 43, 53, 59, 61, 71, 79, 83, 107, 109, 113, 127, 131, 137, 139, 167, 181, 191, 193, 199, 211, 223, 227, 239, 241, 257, 271, 277, 293, 307, 313, 317, 331, 337, 347, 353, 359, 367, 379, 389, 401, 421, 431, 439, 449, 457, 461, 467, 479, 499
Offset: 1

Views

Author

Peter Luschny, Dec 19 2023

Keywords

Comments

We call a quadruple (w, x, y, z) of nonnegative integers a monotone Bacher representation of n if and only if n = w*x + y*z and w <= x < y <= z.

Examples

			For n = 13, the 4 solutions are (w, x, y, z) = (0, 0, 1, 13), (1, 1, 2, 6), (1, 1, 3, 4), (2, 2, 3, 3).
		

Crossrefs

Programs

  • Julia
    using Nemo
    println([n for n in 1:500 if iseven(A368276(n)) && is_prime(n)])
    
  • Mathematica
    t[n_]:=t[n]=Select[Divisors[n],#^2<=n&];
    A368276[n_]:=Total[t[n]]+Sum[Boole[wxA368276[#]]&] (* Paolo Xausa, Jan 02 2024 *)
  • Python
    from itertools import takewhile, islice
    from sympy import nextprime, divisors
    def A368277_gen(startvalue=2): # generator of terms >= startvalue
        p = max(nextprime(startvalue-1),2)
        while True:
            c = sum(takewhile(lambda x:x**2<=p,divisors(p))) &1
            for wx in range(1,(p>>1)+1):
                for d1 in divisors(wx):
                    if d1**2 > wx:
                        break
                    m = p-wx
                    c = c+sum(1 for d in takewhile(lambda x:x**2<=m,divisors(m)) if wxA368277_list = list(islice(A368277_gen(),30)) # Chai Wah Wu, Dec 19 2023
Showing 1-10 of 12 results. Next