I was trying to do that prime factorization CMC in Gaia and wondered why my computer froze when I ran it. I used the wrong operator, and evidently filtering the range [1 .. 12!] for only odd numbers uses a lot of memory
@Ethcad Hm, that would actually be an interesting challenge - you provide a working implementation, and we provide the golfiest version of it. Look into tips as opposed to a regular challenge.
13. VB.NET (.NET 4.5), 1246, A000131
Public Class A000131
Public Shared Function Catalan(n As Long) As Long
Dim ans As Decimal = 1
For k As Integer = 2 To n
ans *= (n + k) / k
Next
Return ans
End Function
Shared Function Answer(n As Long) A...
CMC: Given a string s, find the number of substrings of s with length 3 or greater that are palindromic. The substrings may be overlapping. Example: "abcbab" -> 3 (abcba, bcb, and bab)
So say your running an eCommerce site, and are writing a function to take an array of an order and pack it into boxes.
For example say you have a collection of all the products of the order:
[{ product: "c5b3eb47", weight: 1},
{ product: "c5b3eb47", weight: 1},
{ product: "c5b3eb47",...
RE perfect squares, did anybody know this about perfect squares? I remember thinking I was a genius when I discovered this when I was 11, only to realize it was a known fact in math
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> ...
Ellipsis