A337140 Numbers m = a + b with a and b positive integers whose product a*b = k^2 is a square.
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
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.
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
Comments