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.

User: Hein van Winkel

Hein van Winkel's wiki page.

Hein van Winkel has authored 4 sequences.

A338940 a(n) is the number of solutions to the Diophantine equation p * x * (x + n) = y^2 with p = a*b a perfect square and a+b = n.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 0, 1, 0, 3, 0, 1, 1, 1, 4, 2, 1, 2, 0, 3, 0, 1, 0, 4, 4, 3, 0, 1, 1, 12, 0, 3, 0, 3, 4, 2, 1, 1, 4, 12, 1, 4, 0, 1, 7, 1, 0, 7, 0, 10, 4, 3, 1, 3, 4, 4, 0, 3, 0, 12, 1, 1, 0, 4, 16, 4, 0, 3, 0, 12, 0, 7, 1, 3, 14, 1, 0, 12, 0, 21, 0, 3, 0, 4, 16, 1, 4, 4, 1, 21, 4, 1, 0, 1, 4, 10, 1, 2, 0, 10
Offset: 1

Author

Hein van Winkel, Nov 16 2020

Keywords

Comments

Related to Heron triangles with a partition point on a side of length n where the incircle is tangent. Some partitions correspond to a finite number of Heron triangles. The numbers a(n) in this sequence are the numbers of Heron triangles that match these 'finite' partitions.

Examples

			n = 25 = 5 + 20 = 9 + 16 gives 100 * x * (x + 25) = y^2 or 144 * x * (x + 25) = y^2 or 144 * x * (x + 25) = y^2. And the solutions are (x,y) = (144,1560) or (20,300) or (144,1872) or (20,360).
		

Crossrefs

Formula

Let n = 2^t * p_1^a_1 * p_2^a_2 *...* p_r^a_r * q_1^b_1 * q_2^b_2 *...* q_s^b_s with t>=0, a_i>=0 for i=1..r, where p_i == 1 (mod 4) for i=1..r and q_j = -1 (mod 4) for j=1..s.
Further let A = (2a_1 + 1) * (2a_2 + 1) *...* (2a_r + 1) and B = A * (2b_1 + 1) * (2b_2 + 1) *...* (2b_s + 1).
Then a(n) = (A-1) * (B-1) / 4 for t = 0 and a(n) = A * (B-1) / 2 for t = 1 AND t = 2 and a(n) = (2*t - 3) * A * (B+1) / 2 for t > 2.
a(n) = A338939(n) * A115878(n).

A338939 a(n) is the number of partitions n = a + b such that a*b is a perfect square.

Original entry on oeis.org

0, 1, 0, 1, 1, 1, 0, 1, 0, 3, 0, 1, 1, 1, 1, 1, 1, 1, 0, 3, 0, 1, 0, 1, 2, 3, 0, 1, 1, 3, 0, 1, 0, 3, 1, 1, 1, 1, 1, 3, 1, 1, 0, 1, 1, 1, 0, 1, 0, 5, 1, 3, 1, 1, 1, 1, 0, 3, 0, 3, 1, 1, 0, 1, 4, 1, 0, 3, 0, 3, 0, 1, 1, 3, 2, 1, 0, 3, 0, 3, 0, 3, 0, 1, 4, 1, 1, 1, 1, 3, 1, 1, 0, 1, 1, 1, 1, 1, 0, 5
Offset: 1

Author

Hein van Winkel, Nov 16 2020

Keywords

Comments

Number of ways to regroup the unit squares of a rectangle with semiperimeter n into a square.
a(n) > 0 for n in A337140.

Examples

			n = 10 = 1 + 9 = 2 + 8 = 5 + 5 with 1*9 = 3^2 and 2*8 = 4^2 and 5*5 = 5^2. Then a(10) = 3. Also 10 = 2^1 * 5^1. So t=1, a_1=1 and a(n) = A = 2*1+1 = 3.
		

Crossrefs

Programs

  • Maple
    A338939:=n->map[fold=(`+`,0)](i->if(issqr(i*(n-i)),1,0),[$1..1/2*n]); seq(A338939(n),n=1..100); # Felix Huber, Oct 02 2024
  • Mathematica
    a[n_] := Count[IntegerPartitions[n, {2}], ?(IntegerQ @ Sqrt[Times @@ #] &)]; Array[a, 100] (* _Amiram Eldar, Nov 22 2020 *)
  • PARI
    a(n)=my(c=0);for(i=1,n-1,if((2*i<=n)&&issquare(i*(n-i)),c++));c
    for(n=1,100,print1(a(n),", ")) \\ Derek Orr, Nov 18 2020
    
  • PARI
    a(n) = sum(i=1, n-1, (2*i<=n) && issquare(i*(n-i))); \\ Michel Marcus, Dec 21 2020
    
  • PARI
    first(n) = {my(res = vector(n)); for(i = 1, n, d = divisors(i^2); for(i = (#d + 1)\2, #d, c = d[i] + d[#d + 1 - i]; if(c <= n, res[c]++ , next(2) ) ) ); res } \\ David A. Corneth, Dec 21 2020
    
  • Python
    from sympy.abc import x,y
    from sympy.solvers.diophantine.diophantine import diop_quadratic
    def A338939(n): return len(diop_quadratic(x*(n-x)-y**2))>>2 # Chai Wah Wu, Aug 21 2024

Formula

Let n = 2^t * p_1^a_1 * p_2^a_2 * ... * p_r^a_r * q_1^b_1 * q_2^b_2 *...* q_s^b_s with t >= 0, a_i >= 0 for i = 1..r, where p_i == 1 (mod 4) and q_j == -1 (mod 4) for j = 1..s. Further, let A = (2a_1 + 1)*(2a_2 + 1)*...*(2a_r + 1). Then a(n) = (A-1)/2 for odd n and a(n) = A for even n.
a(n) = A338940(n) / A115878(n).

A337140 Numbers m = a + b with a and b positive integers whose product a*b = k^2 is a square.

Original entry on oeis.org

2, 4, 5, 6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 25, 26, 28, 29, 30, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 48, 50, 51, 52, 53, 54, 55, 56, 58, 60, 61, 62, 64, 65, 66, 68, 70, 72, 73, 74, 75, 76, 78, 80, 82, 84, 85, 86, 87, 88, 89, 90, 91
Offset: 1

Author

Hein van Winkel, Aug 18 2020

Keywords

Comments

Related to Heron triangles with a partition point on one of the sides. Calculations become quite different when the partition a + b = m gives the perfect square k^2 = a*b.
These numbers coincide with the numbers > 1 not in A004614.
Let m = 2^t * p_1^a_1 * p_2^a_2 * ... * p_r^a_r * q_1^b_1 * q_2^b_2 * ... * q_s^b_s with t >= 0, a_i >= 0 for i=1..r, where p_i == 1 (mod 4) for i=1..r and q_j == -1 (mod 4) for j=1..s.
Even numbers (A005843) belong to this sequence: m = 2*k and p = k^2.
Numbers divisible by a prime q congruent to 1 (mod 4) (cf. A004613) belong to this sequence: m = q * m_1 = (u^2 + v^2) * m_1 and p = (u*v*q)^2.
The other numbers are divisible only by primes congruent to 3 (mod 4) (cf. A004614).
If a term m is not in the union of A005843 and A004613, then m = q_1^b_1 * q_2^b_2 * ... * q_s^b_s is a term of A018825 (numbers not the sum of two nonzero squares) = q_i * m_1 = q_i *(u^2 + v) and p = q_i^2 * u^2 * v for all u^2 < m_1 and v nonsquare. And so m is not a term: A contradiction.

Examples

			Even numbers m = 2*k give a = b = k. For example, 94 = 47+47 and k^2 = 47^2.
Numbers which are divisible by a prime q congruent to 1 (mod 4) give m = q*m' = (u^2 + v^2)*m' and p = (u*v*m')^2. For example, 87 = 3*29 = 3*(25 + 4) = (5*4*3)^2 = 60^2.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[100], Length @ Select[Times @@@ IntegerPartitions[#, {2}], IntegerQ @ Sqrt[#1] &] > 0 &] (* Amiram Eldar, Aug 26 2020 *)
  • PARI
    upto(n) = { my(res = List(vector(n\2, i, 2*i))); forstep(i = 1, n, 2, c = core(i); for(k = 1, sqrtint((n-i)\c), listput(res, i + c*k^2); ) ); listsort(res, 1); res } \\ David A. Corneth, Aug 26 2020
    
  • PARI
    is(n) = for(i = 1, n\2 + 1, if(issquare(i * (n-i)), return(n>1))); 0 \\ David A. Corneth, Aug 26 2020
    
  • Python
    from itertools import count, islice
    from sympy import primefactors
    def A337140_gen(startvalue=2): # generator of terms >= startvalue
        return filter(lambda n: n&1^1 or not all(p&2 for p in primefactors(n>>(~n & n-1).bit_length())), count(max(startvalue,2)))
    A337140_list = list(islice(A337140_gen(),30)) # Chai Wah Wu, Aug 21 2024

A180622 Number of distinct sums i+j, absolute differences |i-j|, products ij and quotients i/j and j/i with 1 <= i, j <= n.

Original entry on oeis.org

3, 6, 12, 19, 30, 38, 56, 68, 86, 100, 129, 143, 178, 197, 222, 246, 293, 313, 367, 392, 428, 460, 525, 551, 606, 643, 694, 730, 813, 841, 931, 977, 1034, 1084, 1151, 1188, 1296, 1351, 1419, 1467, 1586, 1627, 1752, 1811, 1880, 1947, 2084, 2132, 2247, 2308
Offset: 1

Author

Hein van Winkel (hein65(AT)duizendknoop.com), Sep 12 2010

Keywords

Comments

I was inspired by the 24-game. How many results can you get from two numbers by addition, subtraction, multiplication and division?

Examples

			For n = 3 sums 2, 3, 4, 5, 6 differences 0, 1, 2 multiplications 1, 2, 3, 4, 6, 9 divisions 1/2, 1/3, 2/3, 2, 3, 3/2 different results are 2, 3, 4, 5, 6, 0, 1, 9, 1/2, 1/3, 2/3, 3/2 or ordered 0, 1/3, 1/2, 2/3, 1, 3/2, 2, 3, 4, 5, 6, 9 so f(3) = 12.
		

Crossrefs

Programs

  • Maple
    A180622 := proc(n) s := {} ; for i from 1 to n do for j from 1 to n do s := s union {i+j} ; s := s union {abs(i-j)} ; s := s union {i*j} ; s := s union {i/j} ; s := s union {j/i} ; end do: end do: nops(s) ; end proc: seq(A180622(n),n=1..83) ; # R. J. Mathar, Sep 19 2010
  • Mathematica
    a180622[maxn_] := Module[{seq = {}, vals = {}, vnew, an, n1}, Do[vnew = {}; n1 = n - 1; Do[vnew = vnew~Join~{i + n, n - i, i*n, i/n, n/i}, {i, n1}]; vnew = vnew~Join~{n + n, 0, n*n, 1}; vals = Union[vals, vnew]; an = Length[vals]; AppendTo[seq, an], {n, maxn}]; seq] (* Owen Whitby, Nov 03 2010 *)
  • Python
    from fractions import Fraction
    def A180622(n): return len(set(range((n<<1)+1))|set().union(*({i*j,Fraction(i,j),Fraction(j,i)} for i in range(1,n+1) for j in range(1,i+1)))) # Chai Wah Wu, Aug 21 2024
    
  • Python
    # faster program
    from functools import lru_cache
    from sympy import primepi
    def A180622(n):
        @lru_cache(maxsize=None)
        def f(n): # based on second formula in A018805
            if n == 0:
                return 0
            c, j = 0, 2
            k1 = n//j
            while k1 > 1:
                j2 = n//k1 + 1
                c += (j2-j)*(f(k1)-1)
                j, k1 = j2, n//j2
            return (n*(n-1)-c+j)
        return len({i*j for i in range(1,n+1) for j in range(1,i+1)})+f(n)+primepi(n<<1)-primepi(n)-n # Chai Wah Wu, Aug 21 2024

Formula

a(n) = A263995(n) + 2*A002088(n) - n = A263995(n) + A018805(n) - n + 1. To see this, terms of the form |i-j| are covered by terms of the form i+j or i*j with the exception of 0. Thus i+j, |i-j| and ij result in A263995(n)+1 distinct terms. Terms i/j where gcd(i,j) > 1 can be reduced to a term i'/j' where gcd(i',j')=1. The only terms left are i/j with gcd(i,j) = 1 for which there are A018805(n) such terms. We need to subtract n terms for the cases where j=1 since i/j=i/1 are integers. This results in the formula. - Chai Wah Wu, Aug 21 2024

Extensions

More terms from R. J. Mathar, Sep 19 2010