-
Notifications
You must be signed in to change notification settings - Fork 75
实用JS代码
zzllrr小乐笑了 edited this page Sep 1, 2023
·
1 revision
素数分解为比其小的所有素数的乘积之差。
var pf=(i=>{if(i<=5){return ''}var A=PrimeA(i),ii=A.indexOf(i),id=seqA(0,ii), c=CombinN(ii, (ii%2+ii)/2);var B=ii<3?[]:c.map(k=>[k.map(j=>A[j]), id.filter(j=>!k.includes(j)).map(j=>A[j]) ]);if(ii%2==0){B=B.slice(0,B.length/2)} B=B.map(k=>{var r=+minus([times(k[0]),times(k[1])]); if(r==i){return k.map(j=>j.join('×')).join('-')} if(r==-i){return [k[1],k[0]].map(j=>j.join('×')).join('-')} return ''}).filter(j=>j); return i+'='+B.join('=')});pf(13)