Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,23 @@
(define (prime? n) (= 1 (length (factor (int n)))))
(define (next-clean-prime n)
(do-until (and (prime? n) (not (find "0" (string n))))
(-- n)))
(define (check p i)
(let (s (string p))
(until (or (empty? s) (not (prime? s)))
(pop s i))
(when (empty? s)
;; Dynamic scope.
(if (zero? i) (setf lefty p) (setf righty p)))))
(define (foo , lefty righty)
(let (p 1000000)
(until (and lefty righty)
(set 'p (next-clean-prime p))
(unless lefty (check p 0))
(unless righty (check p -1)))
(list lefty righty)))
(foo)

View file

@ -1,10 +1,7 @@
Mag ← 6
MaxP ← ⁿ:10⌊÷2Mag
# Pre-calculate primes up to root of largest n
Primes ← ⇌◌⍢(▽≠0◿⊢..⟜(⊂⊢)|>0⧻.):[]⊂2↘1+1×2⇡⌊÷2 MaxP # Build primes
IsPrime ← ⨬(/↧≡(≠0◿)|1)∊:,,Primes
IsPrime ← =1⧻°/×
RAdd ← ♭⊞(+×10):1_3_7_9 # Add suffixes
LAdd ← ♭⊞+×ⁿ:10⌈ₙ10⊢,+1⇡9 # Add prefixes
LAdd ← ♭⊞+×⍜(ₙ10|⌈)⊢,+1⇡9 # Add prefixes
LastTP! ← ⊡¯1⍥(▽⊸≡IsPrime^!)-1Mag 2_3_5_7 # Build and filter
$"Right truncating: _"LastTP!RAdd
$"Left truncating: _"LastTP!LAdd