Re: Simple math/programming challenge for the "REAL programmer" Feeb

Liste des GroupesRevenir à ol advocacy 
Sujet : Re: Simple math/programming challenge for the "REAL programmer" Feeb
De : nospam (at) *nospam* dfs.com (DFS)
Groupes : comp.os.linux.advocacy
Date : 10. Mar 2024, 21:48:47
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <usl2qu$34lr8$3@dont-email.me>
References : 1 2 3 4
User-Agent : Betterbird (Windows)
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?

Date Sujet#  Auteur
10 Mar 24 * Simple math/programming challenge for the "REAL programmer" Feeb19DFS
10 Mar 24 +* Re: Simple math/programming challenge for the "REAL programmer" Feeb17Yaxley Peaks
10 Mar 24 i`* Re: Simple math/programming challenge for the "REAL programmer" Feeb16DFS
10 Mar 24 i +- Re: Simple math/programming challenge for the "REAL programmer" Feeb1Stéphane CARPENTIER
10 Mar 24 i +* Re: Simple math/programming challenge for the "REAL programmer" Feeb12Tyrone
10 Mar 24 i i`* Re: Simple math/programming challenge for the "REAL programmer" Feeb11DFS
10 Mar 24 i i +* Re: Simple math/programming challenge for the "REAL programmer" Feeb5vallor
10 Mar 24 i i i`* Re: Simple math/programming challenge for the "REAL programmer" Feeb4DFS
10 Mar 24 i i i +* Re: Simple math/programming challenge for the "REAL programmer" Feeb2vallor
11 Mar 24 i i i i`- Re: Simple math/programming challenge for the "REAL programmer" Feeb1DFS
10 Mar 24 i i i `- Re: Simple math/programming challenge for the "REAL programmer" Feeb1vallor
10 Mar 24 i i `* Re: Simple math/programming challenge for the "REAL programmer" Feeb5DFS
11 Mar 24 i i  `* Re: Simple math/programming challenge for the "REAL programmer" Feeb4Tyrone
11 Mar 24 i i   +- Re: Simple math/programming challenge for the "REAL programmer" Feeb1DFS
11 Mar 24 i i   `* Re: Simple math/programming challenge for the "REAL programmer" Feeb2Physfitfreak
11 Mar 24 i i    `- Re: Simple math/programming challenge for the "REAL programmer" Feeb1DFS
10 Mar 24 i `* Re: Simple math/programming challenge for the "REAL programmer" Feeb2Yaxley Peaks
10 Mar 24 i  `- Re: Simple math/programming challenge for the "REAL programmer" Feeb1DFS
11 Mar 24 `- Re: Simple math/programming challenge for the "REAL programmer" Feeb1DFS

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal