6 kyu
Simple Fun #146: Chandos Number
127 of 389myjinxin2015
Loading description...
Algorithms
Number Theory
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.
Я не смог решить эту ката не потому что она сложная, а потому что я не смог понять какой именно параметр я получаю и передаю функции, и что именно должна вернуть эта функция. Я не понимаю на каком основании числам Чандоса присваиваеся порядковый номер? Исходя из инструкции: 5 (5^1) - это первый номер, 25 (5^2) второй, 30 (5^1 + 5^2) третий, 125 (5^3) четвертый, 130 (5^1 + 5^3) пятый, 150 (5^2 + 5^3) шестой... По логике следующий седьмой это 625 (5^4), и восьмым будет 630 (5^1 + 5^4). Но в тестах 630 считается девятым! Как такое возможно? Кто-нибудь мне сможет объяснить? Пока я не пойму схему подсчета чисел Чандоса, как определить порядковый номер числа??!!! я не смогу решить эту ката.
You skipped 51+52+53=155 which is the 7th Chandos number.
Very funny.
Nice one, well done.
Scala translation
Approved
Magic numbers. Not Chando's numbers. Wonder where the author got Chando's numbers from. Google doesn't seem to think they exist. Great kata though.
I'm marking as spoiler. Feel free to revert if this hint should be condoned afterall.
No arguments here, dfhwze(2 dan). Say, do you know of any experts here, like yourself, cave.on etc that would accept a new customer that wants to get access to their guidance? I see on some of the katas similar coding style so I concluded they are getting instruction from another codewarrior.
What I suggest is what I also do, whenever you complete a tough kata, take some time to go through other solutions. You can incorporate some of the styles and algorithms into your own.
Okay. Thanks.
Ruby translation should be updated 3.0, see relevent information here: https://github.com/codewars/content-issues/wiki/List-of-Ruby-Kata-to-Update
Enabled in this fork
Amazing kata!very interesting.
more need Chando's number explain i can't know that
Haskell translation
Approved. Who always downvotes you? ;-)
Thanks!
That downvoter: I don't remember. I'm not letting it get to me. I'm not here for the points, and (some) people do seem to appreciate my solutions and translations.
I pass the test but when submitting I get following error:
/tmp/haskell11792-5-vs152q.xcz5wgsyvi/ChandosNumber/Test.hs:28:34: Couldn't match expected type
Integer' with actual type
Int' In the second argument ofshouldBe', namely
referenceChandos n' In the expression: chandos nshouldBe
referenceChandos n/tmp/haskell11792-5-vs152q.xcz5wgsyvi/ChandosNumber/Test.hs:28:51: Couldn't match expected type
Int' with actual type
Integer' In the first argument ofreferenceChandos', namely
n' In the second argument ofshouldBe', namely
referenceChandos n'The expected, and given, type of
chandos
isInt -> Int
. You didn't change that, did you?Testing is limited to values that will fit into a regular
Int
- there is no reason to useInteger
.Enjoyable maths fun with an easy-once-you-have-it-figured solution.
The fun is there, so long as you think it over ;-)
How come exactly that
n==41
orn==50
still expect the same number (16255
)?Well, anyway: kata approved, Python, Ruby and Crystal translations submitted.
And still wondering who's Chando: googling it just gives me pictures of a charming lady. Not complaining, though, but I doubt she is the kata's inspiration.
Probably i'm something missing, but n==50 expects 18775?
@GiacomoSorbi, This is an error on the recursive call, similar to what you have done in the translation ;-) @smile67, Fixed
^_^
I don't think I used a recursive call in my translations here, but possibly you meant in some other katas. Cheers!
This comment has been hidden.
OK, fixed ;-)