Skip to main content
added 60 characters in body
Source Link
DanielIndie
  • 1.2k
  • 6
  • 5
  • still golfing but help will be much appreciated

JavaScript (Node.js), 363 350397 bytes

a=>a.map((x,i)=>x=>(x<=a[-~i]l<=x?s++:s=++s>2&&r(s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next")*0,s=1),P(x)&&P(l)&&r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`),c[l=x]=-~c[x]),c=[s=l=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r&&[...r,...a[20]?[]:[`The Top ${a.length} Array Elements`]]
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!Try it online!

  • still golfing but help will be much appreciated

JavaScript (Node.js), 363 350 bytes

a=>a.map((x,i)=>(x<=a[-~i]?s++:s=++s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next")*0,P(x)&&P(l)&&r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`),c[l=x]=-~c[x]),c=[s=l=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!

  • still golfing but help will be much appreciated

JavaScript (Node.js), 397 bytes

a=>a.map(x=>(l<=x?s++:(s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next"),s=1),P(x)&&P(l)&&r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`),c[l=x]=-~c[x]),c=[s=l=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&[...r,...a[20]?[]:[`The Top ${a.length} Array Elements`]]
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!

deleted 2 characters in body
Source Link
DanielIndie
  • 1.2k
  • 6
  • 5
  • still golfing but help will be much appreciated

JavaScript (Node.js), 363363 350 bytes

a=>a.map((x,i)=>(c[x]=-~c[x],x<=a[-~i]?s++:(s=++s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next")*0),(t=PP(x)&&P(l)&&+p?r&&r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`):0,p=t,l=xc[l=x]=-~c[x]),c=[s=l=p=r=[]]c=[s=l=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!Try it online!

  • still golfing but help will be much appreciated

JavaScript (Node.js), 363 bytes

a=>a.map((x,i)=>(c[x]=-~c[x],x<=a[-~i]?s++:(s=++s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next")*0),(t=P(x))&&+p?r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`):0,p=t,l=x),c=[s=l=p=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!

  • still golfing but help will be much appreciated

JavaScript (Node.js), 363 350 bytes

a=>a.map((x,i)=>(x<=a[-~i]?s++:s=++s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next")*0,P(x)&&P(l)&&r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`),c[l=x]=-~c[x]),c=[s=l=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!

added 20 characters in body
Source Link
DanielIndie
  • 1.2k
  • 6
  • 5
  • still golfing but help will be much appreciated

JavaScript (Node.js), 351363 bytes

a=>a.map(x=>(x,i)=>(c[x]=-~c[x],x<lx<=a[-~i]?s++:(s>2&&rs=++s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next"),s=0*0):s++,(t=P(x))&&+p?r.push(l+` And ${l=xx} Were Spotted Together, You Won't Believe What They Did`):l=x0,p=t,l=x),c=[s=l=p=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!Try it online!

  • still golfing but help will be much appreciated

JavaScript (Node.js), 351 bytes

a=>a.map(x=>(c[x]=-~c[x],x<l?(s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next"),s=0):s++,(t=P(x))&&+p?r.push(l+` And ${l=x} Were Spotted Together, You Won't Believe What They Did`):l=x,p=t),c=[s=l=p=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!

  • still golfing but help will be much appreciated

JavaScript (Node.js), 363 bytes

a=>a.map((x,i)=>(c[x]=-~c[x],x<=a[-~i]?s++:(s=++s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next")*0),(t=P(x))&&+p?r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`):0,p=t,l=x),c=[s=l=p=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&r
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!

Source Link
DanielIndie
  • 1.2k
  • 6
  • 5
Loading