@jordancurve nice. also works in ngn/k with small modifications
@jordancurve lots of opportunities for optimization - e.g. you can punch holes in the sieve starting from p*p instead of p and you can stop the loop when p*p reaches n
it may be better to generate a list of indices and amend (@[x;i;:;1]) the sieve instead of using x|
the initial sieve could be n# of the pattern generated by the first few primes, e.g. for 2 3 5 the pattern is 010000010001010001010001000001b. (needs amendment for the first few elements to make sure 2 3 5 themselves are treated as primes)
the sieve could represent only odd numbers with 2 as a special case
f:"RGB"{3!-n-:/+/x*/(3\6901)(3*3\n-1)+3\!n:#x}"RGB"?
"RGB"? Determine indices of each character in "RGB"
{ } run function:
n:#x set n to string length
! range 0..n-1
3\ convert to base 3 matrix
3*3\n-1 n-1 in base 3
( ) index using this into:
i hope this is about right?
i pieced it together using oK docs(JohnE you're a lifesaver)
: is the most special character in k. when put after a verb, it forces it to be monadic. after an adverb, it's just another adverb (one of the very few digraphs in k), after an identifier, it's assignment
@Razetime oh, I did not know, when I was looking for k I did not find a repl but maybe the drop-down autocomplete box isn't autocompleting 1-letter languages
as far as I understand how it works is that there is a git repo with build instructions and once there are build instructions then the package exists (?) but I am not very familiar with package managers nor with build instructions unfortunately, let me see if i find the kona one
as far as I understand nix is a cross platform package manager that has a concept of reproducible builds and some compute platforms like replit are using it
would also be interesting to have oK and BQN et al in there, I think there is a package for J