Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

60%
+1 −0
Challenges Collatz conjecture; Count the tries to reach $1$

J, 35 char <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_) How it works: NB. <: subtract one from number result on right NB. # count number of items from list result on righ...

posted 2y ago by torres‭  ·  edited 2y ago by torres‭

Answer
#7: Post edited by user avatar torres‭ · 2022-06-01T17:52:18Z (over 2 years ago)
  • # J, 35 char
  • ```
  • <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • ```
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**`
  • # J, 35 char
  • ```
  • <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • ```
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
#6: Post edited by user avatar torres‭ · 2022-06-01T17:51:55Z (over 2 years ago)
  • # J, 35 char
  • > <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**`
  • # J, 35 char
  • ```
  • <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • ```
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**`
#5: Post edited by user avatar torres‭ · 2022-06-01T17:48:06Z (over 2 years ago)
  • # J, 35 char
  • `<:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)`
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**`
  • # J, 35 char
  • > <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**`
#4: Post edited by user avatar torres‭ · 2022-06-01T17:47:31Z (over 2 years ago)
  • # J, 35 char
  • [<:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)]
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**
  • # J, 35 char
  • `<:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)`
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**`
#3: Post edited by user avatar torres‭ · 2022-06-01T17:43:48Z (over 2 years ago)
  • # J, 35 char
  • > <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**
  • # J, 35 char
  • [<:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)]
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**
#2: Post edited by user avatar torres‭ · 2022-06-01T17:31:40Z (over 2 years ago)
  • # J, 35 char
  • > <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • `
  • # J, 35 char
  • > <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)
  • **How it works:**
  • NB. <: subtract one from number result on right
  • NB. # count number of items from list result on right
  • NB. -: if intermediate result is even, half the value
  • NB. ` make a gerund from verb to left and verb to right
  • NB. (>:@:*&3) if intermediate result is odd, multiply by 3
  • NB. @. choose from gerund using index on right
  • NB. (2&|) mod 2 used as index into gerund on left
  • NB. ^:(1&<) repeat verb on left while intermediate value is >1
  • NB. ^:(<_) repeat verb on left until intermediate value stops changing and keep intermediate values in a list
  • **Someone please tell me where I can find the formatting guidelines; I can't find them.**
#1: Initial revision by user avatar torres‭ · 2022-06-01T17:29:20Z (over 2 years ago)
# J, 35 char

>    <:#-:`(>:@:*&3)@.(2&|)^:(1&<)^:(<_)

**How it works:**

NB. <:  subtract one from number result on right

NB. #   count number of items from list result on right

NB. -:  if intermediate result is even, half the value

NB. `  make a gerund from verb to left and verb to right

NB. (>:@:*&3)  if intermediate result is odd, multiply by 3

NB. @.  choose from gerund using index on right

NB. (2&|) mod 2 used as index into gerund on left

NB. ^:(1&<) repeat verb on left while intermediate value is >1

NB. ^:(<_)  repeat verb on left until intermediate value stops changing and keep intermediate values in a list

`