OFFSET
1,2
COMMENTS
The asymptotic density of this sequence is 2 * Product_{p prime} (1 - 2/p^2) = 2 * A065474 = 0.645268... . - Amiram Eldar, Feb 10 2021
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = (A069977(n)+1)/2. - Charles R Greathouse IV, May 15 2016
EXAMPLE
a(1) = 1 because 2*1 - 1 = 1 is squarefree and 2*1 + 1 = 3 is squarefree.
MAPLE
Res:= NULL: count:= 0: state:= 1;
for n from 1 while count < 100 do
if numtheory:-issqrfree(2*n+1) then
if state = 1 then Res:= Res, n; count:= count+1;
else
state:= 1;
fi
else
state:= 0;
fi
od:
Res; # Robert Israel, Apr 15 2019
MATHEMATICA
Select[Range[12^4], And[Or[# == 1, GCD @@ FactorInteger[#][[All, 2]] > 1], SquareFreeQ[# - 1], SquareFreeQ[# + 1]] &] (* Michael De Vlieger, May 08 2016 *)
PROG
(Magma) [n: n in [1..110] | IsSquarefree(2*n-1) and IsSquarefree(2*n+1)];
(PARI) is(n)=issquarefree(2*n-1) && issquarefree(2*n+1) \\ Charles R Greathouse IV, May 15 2016
(Python)
from itertools import count, islice
from sympy import factorint
def A272799_gen(startvalue=1): # generator of terms >= startvalue
return filter(lambda k:max(factorint((k<<1)-1).values(), default=1)==1 and max(factorint((k<<1)+1).values())==1, count(max(startvalue, 1)))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Juri-Stepan Gerasimov, May 06 2016
STATUS
approved