Deutsch English Français Italiano |
<usl39t$347pu$4@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: vallor <vallor@cultnix.org> Newsgroups: comp.os.linux.advocacy Subject: Re: Simple math/programming challenge for the "REAL programmer" Feeb Date: Sun, 10 Mar 2024 19:56:45 -0000 (UTC) Organization: A noiseless patient Spider Lines: 56 Message-ID: <usl39t$347pu$4@dont-email.me> References: <usj06r$2jn18$3@dont-email.me> <87h6heilev.fsf@yaxley.in> <uskh40$30qhq$2@dont-email.me> <09acnYe4UemsSnD4nZ2dnZfqnPidnZ2d@supernews.com> <usl2qu$34lr8$3@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 10 Mar 2024 19:56:45 -0000 (UTC) Injection-Info: dont-email.me; posting-host="81ad7be002f583b290569ed3788100ad"; logging-data="3284798"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RcoaAX9jgzucNO4OppDID" User-Agent: Pan/0.155 (Kherson; c0bf34e gitlab.gnome.org/GNOME/pan.git; x86_64-pc-linux-gnu) Cancel-Lock: sha1:Nri7HBVnSs0YGpz/baTxb0fDAro= X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ Bytes: 2866 On Sun, 10 Mar 2024 15:48:47 -0400, DFS <nospam@dfs.com> wrote in <usl2qu$34lr8$3@dont-email.me>: > On 3/10/2024 11:52 AM, Tyrone wrote: >> On Mar 10, 2024 at 10:46:27 AM EDT, "DFS" <nospam@dfs.com> wrote: > > >> Other than 1, your list above is missing at least 4 numbers: 4879, 5292, 38962 >> and 627615. The reason is you are not handling zeros correctly. > > Depends on who you ask. > > https://oeis.org/A053816 > https://oeis.org/A006886 > > >> But seriously, these numbers are constants. There is no need to waste my time >> and computer time calculating them. > > You just wasted your time and computer time responding to this post. > > > >> Put them in an array and do a search for >> whatever number you want to check. "Is 123456 a Kaprekar number?" Not in the >> array, so no it is not. >> >> Done. > > There are infinite K numbers. > > Better to use a few lines of code to calculate/check them on demand. And > then you can generalize the K code for powers > 2 (not shown here, but > easy to do). > > def isKaprekar(val,exp): > s,n = str(val**exp), len(str(val)) > if len(s) % exp != 0: n-=1 > p1,p2 = int(s[0:n]), int(s[n:]) > if p1 + p2 == val: > return True > else: > return False > > > > > Why waste time re-inventing the wheel? > > What if I want to call out that talentless "REAL programmer / > mathematician / extraordinaire" hack Feeb Russell, so I can watch him > squirm and flub a tiny math program? That would be an off-charter post, like this one. -- -v