Re: Re: Timing

• To: mathgroup at smc.vnet.net
• Subject: [mg88008] Re: [mg87971] Re: Timing
• From: "W_Craig Carter" <ccarter at mit.edu>
• Date: Mon, 21 Apr 2008 14:39:28 -0400 (EDT)
• References: <480A0EE6.3090109@csl.pl> <200804211038.GAA28042@smc.vnet.net>

```Hello Artur,
I am not sure I understand your question:

Member[expr,Integers] && Element[n,Integers]
for 1 <= n <= 17 ?

If so, this may be a hint, although it does not exactly check the above:

Map[Element[Rationalize[#, .00000001], Integers] & ,
Table[expr /. n -> i, {i, 1, 30}]]

and it is reasonably fast.  This approximate method gets worse for
large n; so I don't trust the result except for n=1,3,5

Note, that
Map[Element[Rationalize[Expand[#], .00000001], Integers] & ,
Table[expr /. n -> i, {i, 1, 10}]]

Gives a different result and is much slower, thus emphasizing the
result for large n.

I am curious to see the better solutions....

On Mon, Apr 21, 2008 at 6:38 AM, Artur <grafix at csl.pl> wrote:
> Who know how change bellow procedure to received reasonable timing?
>
>  Part:
>  Expand[((3 + 2 Sqrt[2])^(2^(n - 1) - 1) - (3 - 2 Sqrt[2])^(2^(n - 1) -
>  1))/(4 Sqrt[2])]/(2^n - 1)
>  is every time integer
>  > Timing[Do[ If[IntegerQ[Expand[((3 + 2 Sqrt[2])^(2^(n - 1) - 1) - (3 -
>  > 2 Sqrt[2])^(2^(n - 1) - 1))/(4 Sqrt[2])]/(2^n - 1)],
>  >   Print[n]], {n, 1, 17}]]
>  >
>  I will be greatfull for any help! (Mayby some N[] or Floor[N[]]  or
>  Int[N[]] will be quickest
>
>  Best wishes
>  Artur
>
>

--
W. Craig Carter

```

• References:
• Prev by Date: Re: Polygon cutter
• Next by Date: Vector valued differential equations
• Previous by thread: Re: Timing
• Next by thread: Re: Re: Timing