%I #61 Nov 27 2021 11:16:09
%S 3,12,18,27,30,42,48,72,75,77,98,108,120,147,154,162,168,192,243,255,
%T 260,264,270,272,273,285,288,297,300,308,338,363,378,392,432,450,462,
%U 480,490,494,507,510,513,588,616,630,648,672,675,693,702,714,722,750,754,768,798
%N Positive integers which can be represented as A*(x^2 + y^2 + z^2) = B*(x*y + x*z + y*z) with positive integers x, y, z, A, B and gcd(A,B)=1.
%C The sequence represents a generalization of cases A033428 (k=1), A347960 (k=2), A347969 (k=5) with all possible k given by A331605. Instead of integer k, it utilizes the ratio B/A.
%H Chai Wah Wu, <a href="/A348169/b348169.txt">Table of n, a(n) for n = 1..10000</a>
%H Alexander Kritov, <a href="/A348169/a348169_2.c.txt">Source code</a>
%e a(6)=42: the quintuple (x,y,z) A,B is 1,2,4 (2,3) because 42 = 2*(1^2 + 2^2 + 4^2) = 3*(1*4 + 1*2 + 2*4).
%e a(n) (x,y,z) A, B
%e 3 (1,1,1) 1, 1
%e 12 (2,2,2) 1, 1
%e 18 (1,1,4) 1, 2
%e 27 (3,3,3) 1, 1
%e 30 (1,1,2) 5, 6
%e 42 (1,2,4) 2, 3
%e 48 (4,4,4) 1, 1
%e 72 (1,2,2) 8, 9 [also (2,2,8) 1, 2]
%e 75 (5,5,5) 1, 1
%e 77 (1,1,3) 7, 11
%e 98 (1,4,9) 1, 2
%e 108 (6,6,6) 1, 1
%e 120 (2,2,4) 5, 6
%e 147 (7,7,7) 1, 1
%e 154 (1,2,3) 11, 14
%e 162 (3,3,12) 1, 2
%e 168 (2,4,8) 2, 3
%e 192 (8,8,8) 1, 1
%e 243 (9,9,9) 1, 1
%e 255 (1,1,7) 5, 17
%e 260 (2,5,6) 4, 5
%e 264 (1,4,4) 8, 11
%e 270 (2,5,5) 5, 6
%e 272 (2,2,3) 16, 17
%e 288 (4,4,2) 8, 9 [also (4,4,16) 1, 2]
%o (C) See links.
%o (Python)
%o from itertools import islice, count
%o from math import gcd
%o from sympy import divisors, integer_nthroot
%o def A348169(): # generator of terms
%o for n in count(1):
%o for d in divisors(n,generator=False):
%o x, x2 = 1, 1
%o while 3*x2 <= d:
%o y, y2 = x, x2
%o z2 = d-x2-y2
%o while z2 >= y2:
%o z, w = integer_nthroot(z2,2)
%o if w:
%o A = n//d
%o B, u = divmod(n,x*(y+z)+y*z)
%o if u == 0 and gcd(A,B) == 1:
%o yield n
%o break
%o y += 1
%o y2 += 2*y-1
%o z2 -= 2*y-1
%o else:
%o x += 1
%o x2 += 2*x-1
%o continue
%o break
%o else:
%o continue
%o break
%o A348169_list = list(islice(A348169(),57)) # _Chai Wah Wu_, Nov 26 2021
%Y Cf. A331605, A347969, A347960.
%Y The sequence contains A033428 (A=B=1), A347969 (B=2*A), A347960 (B=5*A).
%K nonn
%O 1,1
%A _Alexander Kritov_, Oct 04 2021
|