OFFSET
1,2
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
MATHEMATICA
Select[Range[100], IntegerQ[Sqrt[#]] || EvenQ[Length[ContinuedFraction[Sqrt[#]][[2]]]] &]
PROG
(PARI)
cyc(cf) = {
if(#cf==1, return([])); \\ There is no cycle
my(s=[]);
for(k=2, #cf,
s=concat(s, cf[k]);
if(cf[k]==2*cf[1], return(s)) \\ Cycle found
);
0 \\ Cycle not found
}
select(n->#cyc(contfrac(sqrt(n)))%2==0, vector(400, n, n)) \\ Colin Barker, Oct 19 2014
(Python)
from itertools import count
from sympy.solvers.diophantine.diophantine import diop_DN
def A206587_gen(startvalue=1): # generator of terms >= startvalue
return filter(lambda n:n==1 or not len(diop_DN(n, -1)), count(max(startvalue, 1))) # Chai Wah Wu, Dec 21 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
T. D. Noe, Mar 20 2012
STATUS
approved
