Re: Re: Timing
- To: mathgroup at smc.vnet.net
- Subject: [mg88010] Re: [mg87971] Re: Timing
- From: Artur <grafix at csl.pl>
- Date: Mon, 21 Apr 2008 14:39:51 -0400 (EDT)
- References: <480A0EE6.3090109@csl.pl> <200804211038.GAA28042@smc.vnet.net> <8ef293d70804210554i3d187e9at22ab6f9e8c743125@mail.gmail.com>
- Reply-to: grafix at csl.pl
Dear Craig,
My problem is find such numbers n that expression
((3 + 2 Sqrt[2])^(2^(n - 1) - 1) - (3 - 2 Sqrt[2])^(2^(n - 1) - 1))/(4 Sqrt[2])
is divisable by (2^n - 1)
or another words (2^n - 1) is divisor of ((3 + 2 Sqrt[2])^(2^(n - 1) - 1) - (3 - 2 Sqrt[2])^(2^(n - 1) - 1))/(4 Sqrt[2])
My procedure
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}]
is extremaly slow (probably Expand function do that as aslowly but without Expand we don't have integers. I don't have idea how improove them.
Best wishes
Artur
W_Craig Carter pisze:
> Hello Artur,
> I am not sure I understand your question:
>
> Are you asking for
> 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
>>
>>
>>
>
>
>
>
- References:
- Re: Timing
- From: Artur <grafix@csl.pl>
- Re: Timing