Squareful

Author

Eric W. Weisstein
September 30, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/NumberTheory/Squareful.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Squareful.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Initialization

<<NumberTheory`NumberTheoryFunctions`;
SquarefulQ[x_]:=!SquareFreeQ[x]

Enumeration

Take[l=Select[Range[10^6],SquarefulQ],20]//Timing

Runs

diffs=-Subtract@@@Partition[l,2,1];

SquarefulRun[n_,l_List,diffs_List]:=Module[{p=
Position[Partition[diffs,n,1],Table[1,{n}],1,1]},
If[p=={},{},l[[p[[1,1]]]]]
]

SquarefulRun[#,l,diffs]&/@Range[10]