Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 694 characters in body
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Arturo, 66 bytes

f:$[x][(block? x)?[p:3∏map x=>[p^f&until->prime? p->'p+2]]->2^x]

Try it

f:$[x][ ; a function f taking an argument x
 (block? x)?[ ; is x a block? then...
 p:3 ; assign 3 to p
 ∏ ; product
 map x=>[ ; map over x, assign current elt to &
 p^f& ; p raised to the Gödel encoding of the current elt
 until->prime? p-> ; until p is prime...
 'p+2 ; add 2 to p via in-place modification
 ] ; end map
 ] ; end the 'true' part of the ternary
 ->2^x ; ...otherwise, if x isn't a block, take 2^x
] ; end function

Arturo, 66 bytes

f:$[x][(block? x)?[p:3∏map x=>[p^f&until->prime? p->'p+2]]->2^x]

Try it

Arturo, 66 bytes

f:$[x][(block? x)?[p:3∏map x=>[p^f&until->prime? p->'p+2]]->2^x]

Try it

f:$[x][ ; a function f taking an argument x
 (block? x)?[ ; is x a block? then...
 p:3 ; assign 3 to p
 ∏ ; product
 map x=>[ ; map over x, assign current elt to &
 p^f& ; p raised to the Gödel encoding of the current elt
 until->prime? p-> ; until p is prime...
 'p+2 ; add 2 to p via in-place modification
 ] ; end map
 ] ; end the 'true' part of the ternary
 ->2^x ; ...otherwise, if x isn't a block, take 2^x
] ; end function
Source Link
chunes
  • 27.8k
  • 3
  • 32
  • 55

Arturo, 66 bytes

f:$[x][(block? x)?[p:3∏map x=>[p^f&until->prime? p->'p+2]]->2^x]

Try it

AltStyle によって変換されたページ (->オリジナル) /