A155717 Numbers of the form N = a^2 + 7b^2 for some positive integers a,b.
8, 11, 16, 23, 29, 32, 37, 43, 44, 53, 56, 64, 67, 71, 72, 77, 79, 88, 92, 99, 107, 109, 112, 113, 116, 121, 127, 128, 137, 144, 148, 149, 151, 161, 163, 172, 176, 179, 184, 191, 193, 197, 200, 203, 207, 211, 212, 224, 232, 233, 239, 253, 256, 259, 261, 263, 268
Offset: 1
Programs
-
Mathematica
Select[Range[300], Reduce[a>0 && b>0 && # == a^2 + 7b^2, {a, b}, Integers] =!= False&] (* Jean-François Alcover, Nov 17 2016 *)
-
PARI
isA155717(n,/* optional 2nd arg allows us to get other sequences */c=7) = { for(b=1,sqrtint((n-1)\c), issquare(n-c*b^2) & return(1))} for( n=1,300, isA155717(n) & print1(n","))
-
Python
def aupto(limit): cands = range(1, int(limit**.5)+2) nums = [a**2 + 7*b**2 for a in cands for b in cands] return sorted(set(k for k in nums if k <= limit)) print(aupto(268)) # Michael S. Branicky, Aug 11 2021
Comments