8
Write a program or function that takes N, and S and outputs the number of palindromes of length S you can build using an alphabet of size N such that any prefix of size between 2 and S-1 is not a palindrome.
For example if N were 2 and S were 5
The valid palindromes would be
01110
10001
And thus the answer would be 2
This is code-golf so answers will be scored in bytes based on their length with fewer bytes being better.
2
Welcome to PPCG! Despite its laconic format, this looks like a valid challenge -- provided that it is neither a dupe nor a question picked somewhere else without permission. At the very least, you'd need to add an objective primary winning criterion such as code-golf. I'd recommend to add some examples and test cases as well.
– Arnauld – 2017-12-28T09:13:50.387@Arnauld It's possible for us to change a off-topic question to a valid challenge (ais523 did that for a few times) but in that case it is obviously not what the OP want. It won't hurt anyway. – user202729 – 2017-12-28T09:15:03.900
the result isn't infinite ? for N >= 2 :
01111111111111111111111111..0
is a palindrome such that any prefix is not a palindrome – Nahuel Fouilleul – 2017-12-28T09:17:05.837@NahuelFouilleul of length S. – user202729 – 2017-12-28T09:17:54.307
1
@user77149 If you ask it here you will get answers like "Jelly, 15 bytes: Try it online!"
– user202729 – 2017-12-28T09:22:58.11314 bytes – user202729 – 2017-12-28T09:24:54.010