Post Reply 
[VA] Short & Sweet Math Challenges #23: "May the 4th Be With You !" Special
06-25-2018, 01:41 PM
Post: #44
RE: [VA] Short & Sweet Math Challenges #23: "May the 4th Be With You !" ...
(06-25-2018 12:42 PM)John Keith Wrote:  I gather that Valentin's original definition of a selfie as the reverse of the sum of powers is aimed at eliminating numbers which end in zero.

Not sure about that. Might as well be to make it a bit more difficult.

Quote:I'm not a Python expert, but if you amend the third line of your program to test that the last digit of s is not zero, it will return Valentin's original 37 numbers (at some cost in execution speed).

Or then you simply filter them out after the computation:
Code:
python selfie.py | grep -v ^0
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] Short & Sweet Math Challenges #23: "May the 4th Be With You !" ... - Thomas Klemm - 06-25-2018 01:41 PM



User(s) browsing this thread: 1 Guest(s)