tinycodinglm / misc /misc-0338.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 16)
d517dc9 verified
|
Raw History Blame
2.8 kB
opencode trace
System You are an expert competitive programmer. You solve problems by analyzing requirements, designing algorithms, and writing clean, efficient code. When solving problems, explain your reasoning step by step before providing...

You are an expert competitive programmer. You solve problems by analyzing requirements, designing algorithms, and writing clean, efficient code. When solving problems, explain your reasoning step by step before providing the final solution.

User

Definition

A number is called Automorphic number if and only if its square ends in the same digits as the number itself.


Task

Given a number determine if it Automorphic or not .


Warm-up (Highly recommended)

Playing With Numbers Series


Notes

  • The number passed to the function is positive

  • Single-digit numbers are considered Automorphic number.


Input >> Output Examples

markdown
autoMorphic (25) -->> return "Automorphic"

Explanation:

  • 25 squared is 625 , Ends with the same number's digits which are 25 .

markdown
autoMorphic (13) -->> return "Not!!"

Explanation:

  • 13 squared is 169 , Not ending with the same number's digits which are 69 .

markdown
autoMorphic (76) -->> return "Automorphic"

Explanation:

  • 76 squared is 5776 , Ends with the same number's digits which are 76 .

markdown
autoMorphic (225) -->> return "Not!!"

Explanation:

  • 225 squared is 50625 , Not ending with the same number's digits which are 225 .

markdown
autoMorphic (625) -->> return "Automorphic"

Explanation:

  • 625 squared is 390625 , Ends with the same number's digits which are 625 .

markdown
autoMorphic (1) -->> return "Automorphic"

Explanation:

  • 1 squared is 1 , Ends with the same number's digits which are 1 .

markdown
autoMorphic (6) -->> return "Automorphic"

Explanation:

  • 6 squared is 36 , Ends with the same number's digits which are 6


Playing with Numbers Series

Playing With Lists/Arrays Series

For More Enjoyable Katas


ALL translations are welcomed

Enjoy Learning !!

Zizou

Starter code:
def automorphic(n):

Assistant

n = int(input())
sq = n * n
if str(sq).endswith(str(n)):
print("Automorphic")
else:
print("Not!!")