Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# Input: an array
# If the rightmost element, .[-1], does not occur elsewhere, return 0;
# otherwise return the "depth" of its rightmost occurrence in .[0:-2]
def depth:
.[-1] as $x
| length as $length
| first(range($length-2; -1; -1) as $i
| select(.[$i] == $x) | $length - 1 - $i)
// 0 ;
# Generate a stream of the first $n van Eck integers:
def vanEck($n):
def v:
recurse( if length == $n then empty
else . + [depth] end );
[0] | v | .[-1];
# The task:
[vanEck(10)], [vanEck(1000)][990:1001]

View file

@ -0,0 +1,2 @@
[0,0,1,0,2,0,2,2,1,6]
[4,7,30,25,67,225,488,0,10,136]