Re: May we trust IntegerQ ?

• To: mathgroup at smc.vnet.net
• Subject: [mg107514] Re: [mg107488] May we trust IntegerQ ?
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Mon, 15 Feb 2010 05:48:15 -0500 (EST)

```As stated in the documentation for IntegerQ:

"IntegerQ[expr] returns False unless expr is manifestly an integer (i.e., has head Integer)."

aa = {}; Do[If[IntegerQ[ChebyshevT[x/2, x]], , AppendTo[aa, x]], {x, 0, 20}];
aa

{3,5,7,9,11,13,15,17,19}

Using FunctionExpand enables Mathematica to recognize the values for 7 and 17 as integers.

aa = {}; Do[
If[IntegerQ[FunctionExpand[ChebyshevT[x/2, x]]], , AppendTo[aa, x]], {x, 0,
20}]; aa

{3,5,9,11,13,15,19}

Oddly, FullSimplify works for 7 but not 17.  I had thought that FullSimplify would always try FunctionExpand.

aa = {}; Do[
If[IntegerQ[FullSimplify[ChebyshevT[x/2, x]]], , AppendTo[aa, x]], {x, 0,
20}]; aa

{3,5,9,11,13,15,17,19}

Bob Hanlon

---- Artur <grafix at csl.pl> wrote:

=============
Procedure: find such x that ChebyshevT[x/2, x] isn't integer
aa = {}; Do[ If[IntegerQ[ChebyshevT[x/2, x]], , AppendTo[aa, x]], {x, 0,
20}]; aa
{3, 5, 7, 9, 11, 13, 15, 17, 19}
where occered e.g. number 7
N[ChebyshevT[7/2, 7],100]
5042.00000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000
evidently is integer 5042