login
Numbers n such that n-1, n and n+1 are all squarefree.
6

%I #38 Mar 31 2023 07:26:17

%S 2,6,14,22,30,34,38,42,58,66,70,78,86,94,102,106,110,114,130,138,142,

%T 158,166,178,182,186,194,202,210,214,218,222,230,238,254,258,266,282,

%U 286,302,310,318,322,330,346,354,358,366,382,390,394,398,402,410,418,430,434,438,446,454,462,466,470,482,498

%N Numbers n such that n-1, n and n+1 are all squarefree.

%C Equivalently, a positive integer n is comfortably squarefree if and only if n^3 - n is squarefree. The 'if' direction is obvious from the factorization n(n-1)(n+1), and the converse follows from the coprimality of n, n - 1 and n + 1.

%C The asymptotic density of comfortably squarefree numbers is the product over all primes of 1 - 3/p^2, which is A206256 = 0.125486980905....

%C See also comments in A007675.

%H Harvey P. Dale, <a href="/A228649/b228649.txt">Table of n, a(n) for n = 1..1000</a>

%H Dan Asimov, <a href="https://mailman.xmission.com/hyperkitty/list/math-fun@mailman.xmission.com/thread/5TNAYAUATD2D5IHWQQIIBPF3QE2O3ILR/">Interesting sequence on MathOverflow</a>, Math-fun mailing list, Mar 28 2023.

%H Ewan Delanoy, <a href="http://mathoverflow.net/questions/59741/are-there-infinitely-many-triples-of-consecutive-square-free-integers">Are there infinitely many triples of consecutive square-free integers?</a>, Math Overflow.

%H A. P. Goucher, <a href="http://cp4space.wordpress.com/2013/08/29/comfortably-squarefree-numbers/">Comfortably squarefree numbers</a>, Complex Projective 4-Space.

%H Fredrick M. Nelson, <a href="https://mathoverflow.net/questions/443446/">Does a(0)=6, a(n+1)=a(n)^3-a(n), define a square-free sequence?</a>, MathOverflow, Mar 24 2023.

%F a(n) = A007675(n) + 1. - _Giovanni Resta_, Aug 29 2013

%p with(numtheory):

%p a := n -> `if`(issqrfree(n-1) and issqrfree(n) and issqrfree(n+1), n, NULL);

%p seq(a(n), n = 1..500); # _Peter Luschny_, Jan 18 2014

%t Select[Range[500], (SquareFreeQ[# - 1] && SquareFreeQ[#] && SquareFreeQ[# + 1]) &] (* _Adam P. Goucher_ *)

%t Select[Range[2, 500, 2], (MoebiusMu[# - 1] MoebiusMu[#] MoebiusMu[# + 1]) != 0 &] (* _Alonso del Arte_, Jan 16 2014 *)

%t Flatten[Position[Partition[Boole[SquareFreeQ/@Range[500]],3,1],{1,1,1}]]+1 (* _Harvey P. Dale_, Jan 14 2015 *)

%t SequencePosition[Table[If[SquareFreeQ[n],1,0],{n,500}],{1,1,1}][[All,1]]+1 (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Dec 02 2018 *)

%o (PARI) is(n)=issquarefree(n-1)&&issquarefree(n)&&issquarefree(n+1) \\ _Charles R Greathouse IV_, Aug 29 2013

%K easy,nonn

%O 1,1

%A _Adam P. Goucher_, Aug 29 2013