Skip to main content
added 52 characters in body
Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60

Haskell, 108108 107 bytes

1!_=[] n!f|n`mod`f<1=f:(n`div`f)!f|x<-f+1=n!x g(h:t)?x|h`mod`x<1=h*x:t|1>0=x:h:t n#b=all(<=b)$foldl(?)[1]$n g[1]$n!2 

Try it online!Try it online!

  • ! finds all prime factors : it divides n by 2 while modulo is 0 then by 3, then by 4.. Wait 4 is not prime! Ah but it was already factorized by 2

    saved 1 thanks to @Unrelated String

  • ? all that to group factors

    ! finds all prime factors : it divides n by 2 while modulo is 0 then by 3, then by 4.. Wait 4 is not prime! Ah but it was already factorized by 2

  • # finally we return True if all are <= B

    g all that to group factors

  • # finally we return True if all are <= B

Haskell, 108 bytes

1!_=[] n!f|n`mod`f<1=f:(n`div`f)!f|x<-f+1=n!x (h:t)?x|h`mod`x<1=h*x:t|1>0=x:h:t n#b=all(<=b)$foldl(?)[1]$n!2 

Try it online!

  • ! finds all prime factors : it divides n by 2 while modulo is 0 then by 3, then by 4.. Wait 4 is not prime! Ah but it was already factorized by 2
  • ? all that to group factors
  • # finally we return True if all are <= B

Haskell, 108 107 bytes

1!_=[] n!f|n`mod`f<1=f:(n`div`f)!f|x<-f+1=n!x g(h:t)x|h`mod`x<1=h*x:t|1>0=x:h:t n#b=all(<=b)$foldl g[1]$n!2 

Try it online!

  • saved 1 thanks to @Unrelated String

  • ! finds all prime factors : it divides n by 2 while modulo is 0 then by 3, then by 4.. Wait 4 is not prime! Ah but it was already factorized by 2

  • g all that to group factors

  • # finally we return True if all are <= B

Source Link
AZTECCO
  • 11k
  • 1
  • 17
  • 60

Haskell, 108 bytes

1!_=[] n!f|n`mod`f<1=f:(n`div`f)!f|x<-f+1=n!x (h:t)?x|h`mod`x<1=h*x:t|1>0=x:h:t n#b=all(<=b)$foldl(?)[1]$n!2 

Try it online!

  • ! finds all prime factors : it divides n by 2 while modulo is 0 then by 3, then by 4.. Wait 4 is not prime! Ah but it was already factorized by 2
  • ? all that to group factors
  • # finally we return True if all are <= B