-1感谢Dennis(用前导符强制进行二进位解释ð
)
-2还要感谢Dennis(由于可以对重复项进行重复数据删除,因此我们可以避免使用R
and和a 2
)
ðp²%QI%ĠẈṂ
接受正整数的单子链接,该正整数产生非负整数。
在线尝试!或查看前50个学期。
怎么样?
ðp²%QI%ĠẈṂ - Link: integer, n e.g. 6
ð - start a new dyadic chain - i.e. f(Left=n, Right=n)
p - Cartesian product of (implicit ranges) [[1,1],[1,2],[1,3],[1,4],[1,5],[1,6],[2,1],[2,2],[2,3],[2,4],[2,5],[2,6],[3,1],[3,2],[3,3],[3,4],[3,5],[3,6],[4,1],[4,2],[4,3],[4,4],[4,5],[4,6],[5,1],[5,2],[5,3],[5,4],[5,5],[5,6],[6,1],[6,2],[6,3],[6,4],[6,5],[6,6]]
² - square (vectorises) [[1,1],[1,4],[1,9],[1,16],[1,25],[1,36],[4,1],[4,4],[4,9],[4,16],[4,25],[4,36],[9,1],[9,4],[9,9],[9,16],[9,25],[9,36],[16,1],[16,4],[16,9],[16,16],[16,25],[16,36],[25,1],[25,4],[25,9],[25,16],[25,25],[25,36],[36,1],[36,4],[36,9],[36,16],[36,25],[36,36]]
% - modulo (by Right) (vectorises) [[1,1],[1,4],[1,3],[1,4],[1,1],[1,0],[4,1],[4,4],[4,3],[4,4],[4,1],[4,0],[3,1],[3,4],[3,3],[3,4],[3,1],[3,0],[4,1],[4,4],[4,3],[4,4],[4,1],[4,0],[1,1],[1,4],[1,3],[1,4],[1,1],[1,0],[0,1],[0,4],[0,3],[0,4],[0,1],[0,0]]
Q - de-duplicate [[1,1],[1,4],[1,3],[1,0],[4,1],[4,4],[4,3],[4,0],[3,1],[3,4],[3,3],[3,0],[0,1],[0,4],[0,3],[0,0]]
I - incremental differences (vectorises) [0,3,2,-1,-3,0,-1,-4,-2,1,0,-3,1,4,3,0]
% - modulo (by Right) (vectorises) [0,3,2,5,3,0,5,2,4,1,0,3,1,4,3,0]
Ġ - group indices by value [[1,6,11,16],[10,13],[3,8],[2,5,12,15],[9,14],[4,7]]
Ẉ - length of each [3,2,2,4,2,2]
Ṃ - minimum 2