// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Count small unordered selections // Not compiled or tested in-world // Setup: Place in a spare owned prim. Set N0..30 and K0..N. Touch to run; output is private to the owner. // Stop / restore: Disable/remove. No scene changes or external calls. // Notes: Uses float arithmetic for a bounded demonstration; larger values quickly lose integer precision. Does not generate combinations. // License: see LICENSE in this distribution. // Original Incoprea. MIT. integer N=12; integer K=4; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; if(N<0||N>30||K<0||K>N) { llOwnerSay("Use0<=k<=n<=30."); return; } integer k=K; if(k>N-k)k=N-k; float result=1.0; integer i; for(i=1;i<=k;++i)result*=((float)(N-k+i)/(float)i); llOwnerSay("Combination count approximately="+(string)result); } }