Find numbers with cubes?

Hi, Community!
I’m trying to find numbers (calculted with some formula) only with cubes (54=27 * 2, 8 * 7=56 etc).
For squares is a function SquareFreeQ in Mathematica, but i found nothing for cubes.
I write smthng, but it doesn’t works:

For[t = 1, t <= 5, t++,
If[StringFreeQ[ToString[FactorInteger[6 t^2 + 4719 t]], ",3}"],
Print["{", t, ",",FactorInteger[6 t^2 + 4719 t], "},"]]]

Real answer (if construction “StringFreeQ[ToString[FactorInteger…” works OK - answer’ll be without first string) :
{1,{{3,3},{5,2},{7,1}}},
{2,{{2,1},{3,1},{19,1},{83,1}}},
{3,{{3,2},{1579,1}}},
{4,{{2,2},{3,2},{17,1},{31,1}}},
{5,{{3,1},{5,1},{1583,1}}},

So, what’s wrong?

Alexey,

cubeFind[x_Integer] := Select[FactorInteger[x], #[[2]] >= 3 &]

This will find your cubes. You can return True or False instead by checking for Empty Set:

cubeQ[x_Integer] := 
 Not[Select[FactorInteger[x], #[[2]] >= 3 &] === {}]

You can obviously just return the first part (the factor) or a list of factors by editing this.

Regards

Note: It is a mistake to go to strings for this type of coding. Things are simpler and faster as numbers. You probably already know this but for others reading the thread I suggest learning the pattern matching capabilities of Mathematica. They are very powerful. see the documentation pattern matching, also see Select and DeleteCases and other related list handling functions here

Thanks a lot - use your idea, it works!!!