Nп/п : 10 из 100
 От   : Paul Rubin                          2:5075/128        17 сен 23 17:09:38
 К    : Ben Bacarisse                                         17 сен 23 03:13:03
 Тема : Re: project euler 29
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <87zg1kpcjh.fsf@nightsong.com> 612ee831
@REPLY: <87ediwl7oq.fsf@bsb.me.uk> e48861a8
@REPLYADDR Paul Rubin <no.email@nospam.invalid>
@REPLYTO 2:5075/128 Paul Rubin
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: <87zg1kpcjh.fsf@nightsong.com>
<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>
@TZUTC: -0700
@PID: Gnus/5.13 (Gnus v5.13) Emacs/27.1
(gnu/linux)
@TID: FIDOGATE-5.12-ge4e8b94
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.
--- Gnus/5.13 (Gnus v5.13) Emacs/27.1 (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    
                                                                                
В этой области больше нет сообщений.

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