7 kyu
Figurate Numbers #2 - Pronic Number
1,174 of 2,855DivyanshBatham
Loading description...
Mathematics
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
C# random tests almost always expect
false
PHP translation
C translation
C++ translation
Rejected by someone, refer to comments in translation discourse and create a new fork as a fix
Julia translation
Approved
COBOL translation.
approved
Ruby 3.0 should be enabled.
done
You should mention that input may be negative (at least in Python).
fixed
java translation added ;)
Applied some improvements and approved.
Powered by katafix 🤖
i can not do proclonic number example
I suggest you to extend the test suit of this Kata in Ruby, it's passing with no problems for the non-positive numbers, which actually cannot be Pronic as (-5) * (-6) is not -30 ;-)
There are already fixed tests with negative numbers, your solution will also return
false
(which is correct) forn = -5
/n = -6
because whenx = 2
,-6 != 2 * 3
for both cases above.C# translation kumited!
I'm pretty sure that there's a duplicate of this kata… However, it could take a while to find it. The other one definitely didn't call the numbers "pronic".
Even I also think so :-| And as it was not easy to find one so I created this kata :-)
Why is that we have very few solvers of Figurate Numbers #1 - Pentagonal Number??
Please don't use
>
for indentation. It's meant for quotes.Ok :) But is it a thumb rule? & I just used it to make comment prettier.
Yes. It creates a
<blockquote>
element. It's meant for email-style quoting.Random notes: training on pronic numbers is good, testing it on every kind of Object and prototyping a method for this a tad less.
Also, most of the random tests (like 98% or so) seem to return
false
, so I would work on that too.Any help how can I get biased random number???
Just two calls of
random
. First decide if the next number will be be pronic then generate this kind of number.Precisely what I did :)
Now is fixed :)