Nп/п : 11 из 100
 От   : Ben Bacarisse                       2:5075/128        18 сен 23 01:16:19
 К    : Paul Rubin                                            18 сен 23 03:21:02
 Тема : Re: project euler 29
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <8734zcl4j0.fsf@bsb.me.uk> d5c039f3
@REPLY: <87zg1kpcjh.fsf@nightsong.com> 612ee831
@REPLYADDR Ben Bacarisse <ben.usenet@bsb.me.uk>
@REPLYTO 2:5075/128 Ben Bacarisse
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: <8734zcl4j0.fsf@bsb.me.uk>
<beaa0494-5783-4130-b96f-1a5271466678n@googlegroups.com><874jjvmoi9.fsf@bsb.me.u
k><a10a258f-8a3a-4017-bb30-8fe5629089ffn@googlegroups.com><87sf7dltq0.fsf@bsb.me
.uk><87jzsplr49.fsf@bsb.me.uk><715fe49a-47bc-46be-ae26-9ed89b38bcb5n@googlegroups.co
m><87ediwl7oq.fsf@bsb.me.uk> <87zg1kpcjh.fsf@nightsong.com>
@TZUTC: 0100
@PID: Gnus/5.13 (Gnus v5.13) Emacs/28.2
(gnu/linux)
@TID: FIDOGATE-5.12-ge4e8b94
Paul Rubin <no.email@nospam.invalid> writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>> Also, do you have a different approach to solve this 29th problem?
>>
>> Yes, but it`s not in Ada.  I implemented an equality test for a^b ==
>> c^d.
>
> Oh interesting, based on a comment in Francesc`s code, I think I see a
> method to do it without the auxiliary array, at a small increase in
> runtime cost.  Basically given a and b, you can find their prime factors
> and easily enumerate the combinations x,y with a**b==x**y and
> 1 <= x,y <= 100.  You can label each "equivalence class" by the (a,b)
> with the smallest possible a.
>
> So you just loop through 1 <= a,b <= 100 and count only the a,b pairs
> where a is the smallest a for its equivalence class.  I might see if I
> can code this, which should also let me describe it more concisely.

This is likely to be fast which is why I wanted to compile Francesc`s to
try it out.  Mind you, a naive a^b == c^d test gives pretty good
performance for the kind of range requested.

-- 
Ben.
--- Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
 * Origin: A noiseless patient Spider (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх