Weekly Challenge: Fractional Constant
dev.to·2d·
Discuss: DEV
🔢Numerical Methods
Preview
Report Post

Weekly Challenge 357

Each week Mohammad S. Anwar sends out The Weekly Challenge, a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. It’s a great way for us all to practice some coding.

Challenge, My solutions

Task 1: Kaprekar Constant

Task

Write a function that takes a 4-digit integer and returns how many iterations are required to reach Kaprekar’s constant (6174).

My solution

This is where GitHub Copilot really scars me somewhat. Without mentioning "…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help