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

66%
+2 −0
Challenges Length of a Sumac Sequence

Jelly, 9 bytes Rȧ_@Rп@L Try it online! Takes $t_1$ on the left and $t_2$ on the right. R}ȧ_@RпL works given the arguments in the opposite order. R Ascending range from 1 to t_1 (...

posted 4y ago by Unrelated String‭  ·  edited 4y ago by Unrelated String‭

Answer
#2: Post edited by user avatar Unrelated String‭ · 2021-01-05T12:51:47Z (almost 4 years ago)
  • # [Jelly], 9 bytes
  • Rȧ_@Rп@L
  • [Try it online!][TIO-kjjywv5m]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kjjywv5m]: https://tio.run/##y0rNyan8/z/oxPJ4h6DDEw7td/D5f3i5/qOmNZH//0cbGhnomBvG6kQbGhjqmBgBGaYGBjomlpZAlrGFuQ5IylhH19DIAsjQNdIxBlIGOgaxAA "Jelly – Try It Online"
  • Takes $t_1$ on the left and $t_2$ on the right. [`R}ȧ_@RпL`](https://tio.run/##y0rNyan8/z@o9sTyeIegwxMO7ff5f3i5g/6jpjWR//9HGxoZ6JgbxupEGxoY6pgYARmmBgY6JpaWQJaxhbkOSMpYR9fQyALI0DXSMQZSBjoGsQA) works given the arguments in the opposite order.
  • # [Jelly], 9 bytes
  • Rȧ_@Rп@L
  • [Try it online!][TIO-kjjywv5m]
  • [Jelly]: https://github.com/DennisMitchell/jelly
  • [TIO-kjjywv5m]: https://tio.run/##y0rNyan8/z/oxPJ4h6DDEw7td/D5f3i5/qOmNZH//0cbGhnomBvG6kQbGhjqmBgBGaYGBjomlpZAlrGFuQ5IylhH19DIAsjQNdIxBlIGOgaxAA "Jelly – Try It Online"
  • Takes $t_1$ on the left and $t_2$ on the right. [`R}ȧ_@RпL`](https://tio.run/##y0rNyan8/z@o9sTyeIegwxMO7ff5f3i5g/6jpjWR//9HGxoZ6JgbxupEGxoY6pgYARmmBgY6JpaWQJaxhbkOSMpYR9fQyALI0DXSMQZSBjoGsQA) works given the arguments in the opposite order.
  • ```
  • R Ascending range from 1 to t_1 (truthy if positive),
  • ȧ and:
  • п collecting intermediate results, loop while
  • R positive
  • @ on the reversed arguments:
  • _ subtract
  • @ the first from the second.
  • L Return the length of the conjunction.
  • ```
  • `¿` and family, given a dyad, replace the right argument with the previous left argument on each successive iteration. This is incredibly bothersome for some tasks, but perfect for working with this exact kind of sequence.
#1: Initial revision by user avatar Unrelated String‭ · 2021-01-05T12:29:09Z (almost 4 years ago)
# [Jelly], 9 bytes

    Rȧ_@Rп@L

[Try it online!][TIO-kjjywv5m]

[Jelly]: https://github.com/DennisMitchell/jelly
[TIO-kjjywv5m]: https://tio.run/##y0rNyan8/z/oxPJ4h6DDEw7td/D5f3i5/qOmNZH//0cbGhnomBvG6kQbGhjqmBgBGaYGBjomlpZAlrGFuQ5IylhH19DIAsjQNdIxBlIGOgaxAA "Jelly – Try It Online"

Takes $t_1$ on the left and $t_2$ on the right. [`R}ȧ_@RпL`](https://tio.run/##y0rNyan8/z@o9sTyeIegwxMO7ff5f3i5g/6jpjWR//9HGxoZ6JgbxupEGxoY6pgYARmmBgY6JpaWQJaxhbkOSMpYR9fQyALI0DXSMQZSBjoGsQA) works given the arguments in the opposite order.