Beta

Is a Number Square?

Description:

You decide to take a stroll along the beach with a friend, who happens to be quite fond of mathematics. Perhaps there's more than friendship brewing, and you're eager to impress them. Suddenly, a truck loaded with numbers topples over nearby!. This unexpected event presents you with an opportunity to demonstrate your affection! Your plan: find a number amidst the chaos and confidently declare it a perfect square to sweep your love interest off their feet. However, with numbers scattered everywhere, time is of the essence. You must act swiftly before this romantic moment slips away!

Your task is to implement a function:

fn is_square(n: &BigInt) -> bool

that will return true if the number is a square number, and false otherwise

performance specifications:
time for 5,000,000 calculations where 0 < n < 726398497465238697234567235472354723457634528594367282345342697845892354867
must be less then 3.5 seconds

time for 5,000,000 calculations where 0 < n < 1000
must be less then 0.5 seconds

Algorithms
Mathematics

More By Author:

Check out these other kata created by potzko

Stats:

CreatedMay 20, 2024
PublishedMay 20, 2024
Warriors Trained25
Total Skips1
Total Code Submissions48
Total Times Completed4
Rust Completions4
Total Stars0
% of votes with a positive feedback rating50% of 1
Total "Very Satisfied" Votes0
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes0
Total Rank Assessments2
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • potzko Avatar
Ad