##Actually, 19 bytes
Actually, 19 bytes
╗1`r♂Pεj╜@íu`;)╓i@ƒ
Takes a string as input and outputs the 1-based index of the substring
Explanation:
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗ push input to register 0
`r♂Pεj╜@íu`;) push this function twice, moving one copy to the bottom of the stack:
r♂Pεj concatenate primes from 0 to n-1 (inclusive)
╜@íu 1-based index of input, 0 if not found
1 ╓ find first value of n (starting from n = 0) where the function returns a truthy value
i@ flatten the list and move the other copy of the function on top
ƒ call the function again to get the 1-based index
##Actually, 19 bytes
╗1`r♂Pεj╜@íu`;)╓i@ƒ
Takes a string as input and outputs the 1-based index of the substring
Explanation:
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗ push input to register 0
`r♂Pεj╜@íu`;) push this function twice, moving one copy to the bottom of the stack:
r♂Pεj concatenate primes from 0 to n-1 (inclusive)
╜@íu 1-based index of input, 0 if not found
1 ╓ find first value of n (starting from n = 0) where the function returns a truthy value
i@ flatten the list and move the other copy of the function on top
ƒ call the function again to get the 1-based index
Actually, 19 bytes
╗1`r♂Pεj╜@íu`;)╓i@ƒ
Takes a string as input and outputs the 1-based index of the substring
Explanation:
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗ push input to register 0
`r♂Pεj╜@íu`;) push this function twice, moving one copy to the bottom of the stack:
r♂Pεj concatenate primes from 0 to n-1 (inclusive)
╜@íu 1-based index of input, 0 if not found
1 ╓ find first value of n (starting from n = 0) where the function returns a truthy value
i@ flatten the list and move the other copy of the function on top
ƒ call the function again to get the 1-based index
##Actually, 19 bytes
╗1`r♂Pεj╜@íu`;)╓i@ƒ
Takes a string as input and outputs the 1-based index of the substring
Try it online!Try it online!
Explanation:
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗ push input to register 0
`r♂Pεj╜@íu`;) push this function twice, moving one copy to the bottom of the stack:
r♂Pεj concatenate primes from 0 to n-1 (inclusive)
╜@íu 1-based index of input, 0 if not found
1 ╓ find first value of n (starting from n = 0) where the function returns a truthy value
i@ flatten the list and move the other copy of the function on top
ƒ call the function again to get the 1-based index
##Actually, 19 bytes
╗1`r♂Pεj╜@íu`;)╓i@ƒ
Takes a string as input and outputs the 1-based index of the substring
Try it online!
Explanation:
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗ push input to register 0
`r♂Pεj╜@íu`;) push this function twice, moving one copy to the bottom of the stack:
r♂Pεj concatenate primes from 0 to n-1 (inclusive)
╜@íu 1-based index of input, 0 if not found
1 ╓ find first value of n (starting from n = 0) where the function returns a truthy value
i@ flatten the list and move the other copy of the function on top
ƒ call the function again to get the 1-based index
##Actually, 19 bytes
╗1`r♂Pεj╜@íu`;)╓i@ƒ
Takes a string as input and outputs the 1-based index of the substring
Explanation:
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗ push input to register 0
`r♂Pεj╜@íu`;) push this function twice, moving one copy to the bottom of the stack:
r♂Pεj concatenate primes from 0 to n-1 (inclusive)
╜@íu 1-based index of input, 0 if not found
1 ╓ find first value of n (starting from n = 0) where the function returns a truthy value
i@ flatten the list and move the other copy of the function on top
ƒ call the function again to get the 1-based index
##Actually, 19 bytes
╗1`r♂Pεj╜@íu`;)╓i@ƒ
Takes a string as input and outputs the 1-based index of the substring
Try it online!
Explanation:
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗ push input to register 0
`r♂Pεj╜@íu`;) push this function twice, moving one copy to the bottom of the stack:
r♂Pεj concatenate primes from 0 to n-1 (inclusive)
╜@íu 1-based index of input, 0 if not found
1 ╓ find first value of n (starting from n = 0) where the function returns a truthy value
i@ flatten the list and move the other copy of the function on top
ƒ call the function again to get the 1-based index