Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Circular-primes/Jq/circular-primes-1.jq
Normal file
12
Task/Circular-primes/Jq/circular-primes-1.jq
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def is_circular_prime:
|
||||
def circle: range(0;length) as $i | .[$i:] + .[:$i];
|
||||
tostring as $s
|
||||
| [$s|circle|tonumber] as $c
|
||||
| . == ($c|min) and all($c|unique[]; is_prime);
|
||||
|
||||
def circular_primes:
|
||||
2, (range(3; infinite; 2) | select(is_circular_prime));
|
||||
|
||||
# Probably only useful with unbounded-precision integer arithmetic:
|
||||
def repunits:
|
||||
1 | recurse(10*. + 1);
|
||||
1
Task/Circular-primes/Jq/circular-primes-2.jq
Normal file
1
Task/Circular-primes/Jq/circular-primes-2.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
limit(19; circular_primes)
|
||||
3
Task/Circular-primes/Jq/circular-primes-3.jq
Normal file
3
Task/Circular-primes/Jq/circular-primes-3.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
last(limit(19; circular_primes)) as $max
|
||||
| limit(4; repunits | select(. > $max and is_prime))
|
||||
| "R(\(tostring|length))"
|
||||
Loading…
Add table
Add a link
Reference in a new issue