Ẇa6ḌạÐṂ⁸Ṫ
একটি monadic লিঙ্ক।
এটি অনলাইন চেষ্টা করুন! - এই লিঙ্কে প্রায় কোনও পয়েন্ট নেই (নীচে দেখুন)!
কিভাবে?
সত্য গল্ফারের স্টাইলে এটি সত্যই অক্ষম - এটি 365 পরীক্ষার ক্ষেত্রে টিআইওতে 60 এর দশকের সময়কে হিট করে ! স্থানীয়ভাবে এটি 37s এ শেষ হয়।
Ẇa6ḌạÐṂ⁸Ṫ - Main link: n
Ẇ - all sublists - this has an implicit make_range on it's input
- so, for example, an input of 3 yields [[1],[2],[3],[1,2],[2,3],[1,2,3]]
- the important things are: that it contains both a list of the length of the
- decimal number, and a list 1 shorter; and that it's lists only contain
- non-zero numbers and are monotonically increasing in length.
6 - literal 6
a - and (vectorises), this changes all the values to 6s
- so, the example above becomes [[6],[6],[6],[6,6],[6,6],[6,6,6]]
Ḍ - convert to decimal (vectorises) [ 6, 6,, 6, 66, 66, 666 ]
⁸ - link's right argument, n
ÐṂ - filter keep those with minimal:
ạ - absolute difference (for 366 this keeps 66 AND 666; same goes for 3666; etc.)
Ṫ - tail - get the rightmost result (for 366 keeps 666, since it's longer)
মধ্যে 60 জন্য সীমা প্যাচ একই এলগরিদম চালানোর জন্য 365 এবং 366 Tio উপর অন্তর্নিহিত vectorisation এড়াতে হয় Ḍসঙ্গে Ẇa6Ḍ€ạÐṂ⁸Ṫ( যে চেষ্টা ), যাইহোক, এই হবে এখন একটি ইনপুট জন্য seg ফল্ট 999 ( ট্রায়াঙ্গেল (999) শুধুমাত্র 499,500 তবে প্রত্যেকটি সংক্ষিপ্তসারগুলির তালিকা, মোট টেট্রহেড্রাল তৈরি করে (999) = 166,666,500 পূর্ণসংখ্যা, মেমরি দক্ষ নয়, কমপক্ষে পাইথনে)।