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-5 of 5 results.

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

A368278 Prime numbers that have an odd number of monotone Bacher representations (A368276).

Original entry on oeis.org

2, 3, 11, 19, 29, 31, 37, 41, 47, 67, 73, 89, 97, 101, 103, 149, 151, 157, 163, 173, 179, 197, 229, 233, 251, 263, 269, 281, 283, 311, 349, 373, 383, 397, 409, 419, 433, 443, 463, 487, 491, 521, 523, 557, 577, 587, 601, 607, 619, 659, 661, 673, 677, 701, 719
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 = 19, the 5 solutions are (w, x, y, z) = (0, 0, 1, 19), (1, 1, 2, 9), (1, 1, 3, 6), (1, 3, 4, 4), (2, 2, 3, 5).
		

Crossrefs

Programs

  • Julia
    using Nemo
    println([n for n in 1:720 if isodd(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 divisors, nextprime
    def A368278_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 wxA368278_list = list(islice(A368278_gen(),30)) # Chai Wah Wu, Dec 19 2023

A368207 Bacher numbers: number of nonnegative representations of n = w*x+y*z with max(w,x) < min(y,z).

Original entry on oeis.org

1, 2, 2, 5, 3, 8, 4, 8, 9, 9, 6, 18, 7, 12, 14, 19, 9, 20, 10, 27, 16, 18, 12, 34, 20, 21, 20, 30, 15, 44, 16, 32, 24, 27, 30, 51, 19, 30, 28, 49, 21, 58, 22, 42, 41, 36, 24, 70, 35, 47, 36, 49, 27, 66, 36, 72, 40, 45, 30, 88, 31, 48, 62, 71, 42, 74, 34, 63, 48
Offset: 1

Views

Author

Don Knuth, Dec 16 2023

Keywords

Comments

When n = p is an odd prime, Bacher proved that a(p) = (p+1)/2.
It appears that also a(k*p) = sigma(k)*(p+1)/2, for all prime p > 2k, where sigma(k) is the sum of the divisors of k (A000203).
It appears furthermore that a(p^2) = (p^2 + 3*p)/2; a(p^3) = (p^3 + p^2 + p + 1)/2; a(p^4) = (p^4 + p^3 + 3p^2 + p)/2, for all prime p.
Conjectures: (1) a(n) >= sigma(n)/2, with equality if and only if n has no middle divisors, i.e., if and only if n is in A071561. (2) a(n)/sigma(n) converges to 1/2. - Pontus von Brömssen, Dec 18 2023
From Chai Wah Wu, Dec 19 2023: (Start)
Considering representations where min(w,x)=0 shows that a(n) >= 2*A066839(n) - A038548(n).
It appears that a(p^5) = (p^5 + p^4 + p^3 + p^2 + p + 1)/2 for all prime p > 2 and a(p^6) = (p^6 + p^5 + p^4 + 3p^3 + p^2 + p)/2 for all prime p.
Conjecture: a(p^m) = sigma(p^m)/2 for odd m and all prime p > 2. a(p^m) = (sigma(p^m)-1)/2 + p^(m/2) for even m and all prime p. a(2^m) = sigma(2^m)/2 + 1/2 for m odd. (End)

Examples

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

Crossrefs

Cf. A000203, A071561, A368276 (monotone), A368341 (fixed points), A368457, A368458 (semiprimes), A368580 (degenerated).

Programs

  • CWEB
    @ See Knuth link.
    
  • Julia
    function A368207(n)
        t(n) = (d for d in divisors(n) if d * d <= n)
        s(d) = d * d == n ? d * 2 - 1 : d * 4 - 2
        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=sum(s(d) for d in t(n)))
    end
    println([A368207(n) for n in 1:69])  # Peter Luschny, Dec 21 2023
  • Mathematica
    t[n_] := t[n] = Select[Divisors[n], #^2 <= n&];
    A368207[n_] := Sum[(1 + Boole[d^2 < n])(2d - 1),{d, t[n]}] + Sum[If[wx < y*w, Max[1, 2(Boole[w^2 < wx] + Boole[y^2 < n-wx])], 0], {wx, Floor[n/2]},{w, t[wx]}, {y, t[n - wx]}];
    Array[A368207, 100] (* Paolo Xausa, Jan 02 2024 *)
  • Python
    # See Branicky link for translation of Knuth's CWEB program.
    
  • Python
    from math import isqrt
    def A368207(n):
        c, r = 0, isqrt(n)
        for w in range(r+1):
            for x in range(w,r+1):
                wx = w*x
                if wx>n:
                    break
                for y in range(x+1,r+1):
                    for z in range(y,n+1):
                        yz = wx+y*z
                        if yz>n:
                            break
                        if yz==n:
                            m = 1
                            if w!=x:
                                m<<=1
                            if y!=z:
                                m<<=1
                            c+=m
        return c # Chai Wah Wu, Dec 19 2023
    
  • Python
    from sympy import divisors
    # faster program
    def A368207(n):
        c = 0
        for d2 in divisors(n):
            if d2**2 > n:
                break
            c += (d2<<2)-2 if d2**2>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
        return c # Chai Wah Wu, Dec 19 2023
    

Formula

Let t(n) = {d|n and d*d <= n}, and s(d, n) = 2*d - 1 if d*d = n, otherwise 4*d - 2. Then a(n) = (Sum_{d in t(n)} s(d, n)) + (Sum_{k=1..floor(n/2)} Sum_{w in t(k)} Sum_{y in t(n-k) and k < y*w} max(1, 2*([w*w < k] + [y*y < n - k]))), where [] denote the Iverson brackets. (See the 'Julia' implementation below.) - Peter Luschny, Dec 21 2023

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.
Showing 1-5 of 5 results.