Menu

1 / 2

Weekly Challenge: Pythagoras Prime

DEV Community: perl·Simon Green·5 days ago
#lYmYVArV
#devtoperl#devto#dev#return#target
Reading 0:00
15s threshold

Weekly Challenge 393

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. Unless otherwise stated, Copilot (and other AI tools) have NOT been used to generate the solution. It's a great way for us all to practice some coding.

Challenge , My solutions

Task 1: Pythagoras Multiplied

You are given a positive integer n .

Find the number of all positive integer triplets ( a , b , c ) so that a² + b² = c² and a , b and c are integers <= n.

My solution

Since $a and $b are special variables in Perl, I call the values i , j and k .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.