Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Don't kid yourself. Little is relevant, and nothing lasts forever.


interests / rec.puzzles / Count-Trailing-Zeros(x) ----- Can I use Log(x) to see if X is equal to ( Integer * 10 ^ k) ???

SubjectAuthor
o Count-Trailing-Zeros(x) ----- Can I use Log(x) to see if X is equalhenh...@gmail.com

1
Count-Trailing-Zeros(x) ----- Can I use Log(x) to see if X is equal to ( Integer * 10 ^ k) ???

<e87bc4bb-5eb3-424c-a03a-5633cd2c9048n@googlegroups.com>

  copy mid

https://novabbs.com/interests/article-flat.php?id=490&group=rec.puzzles#490

  copy link   Newsgroups: rec.puzzles
X-Received: by 2002:a0c:a90a:0:b0:4ad:715:897 with SMTP id y10-20020a0ca90a000000b004ad07150897mr11635411qva.114.1663516655452;
Sun, 18 Sep 2022 08:57:35 -0700 (PDT)
X-Received: by 2002:a05:620a:318d:b0:6ce:d8de:bab2 with SMTP id
bi13-20020a05620a318d00b006ced8debab2mr5571888qkb.456.1663516655278; Sun, 18
Sep 2022 08:57:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: rec.puzzles
Date: Sun, 18 Sep 2022 08:57:35 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2601:648:8600:6f70:803f:74ae:78bc:a4ef;
posting-account=YjTkGAoAAAA4_fbAISfvtIqrYbghMeBx
NNTP-Posting-Host: 2601:648:8600:6f70:803f:74ae:78bc:a4ef
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e87bc4bb-5eb3-424c-a03a-5633cd2c9048n@googlegroups.com>
Subject: Count-Trailing-Zeros(x) ----- Can I use Log(x) to see if X is equal
to ( Integer * 10 ^ k) ???
From: henha...@gmail.com (henh...@gmail.com)
Injection-Date: Sun, 18 Sep 2022 15:57:35 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1954
 by: henh...@gmail.com - Sun, 18 Sep 2022 15:57 UTC

--------- (in Python) is there a simple string function that counts the leftmost 0's ???

Count how many zeros are at the end of your int:

def end_zeros(num):
s = str(num)
return len(s) - len(s.rstrip("0"))

print(end_zeros(10)) # == 1
print(end_zeros(101)) # == 0
print(end_zeros(245)) # == 0
print(end_zeros(100100)) # == 2

---------------- Writing a loop (using % and // ) feels like [reinventing the wheel] and seems intrinsically wrong. --- (it must be unPythonic)

i like this code (above) because it's not reinventing the wheel --- the Python implementors have already done the loop (using % and // ), so i'm just using that efficient tool (routine).

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor