Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -1,6 +1,6 @@
|
|||
BEGIN # find all primes with strictly increasing digits #
|
||||
PR read "primes.incl.a68" PR # include prime utilities #
|
||||
PR read "rows.incl.a68" PR # include array utilities #
|
||||
PR read "sort.incl.a68" PR # include sort utilities #
|
||||
[ 1 : 512 ]INT primes; # there will be at most 512 (2^9) primes #
|
||||
INT p count := 0; # number of primes found so far #
|
||||
FOR d1 FROM 0 TO 1 DO
|
||||
|
|
@ -36,7 +36,7 @@ BEGIN # find all primes with strictly increasing digits #
|
|||
OD
|
||||
OD
|
||||
OD;
|
||||
QUICKSORT primes FROMELEMENT 1 TOELEMENT p count; # sort the primes #
|
||||
primes QUICKSORT ELEMENTS( 1, p count ); # sort the primes #
|
||||
FOR i TO p count DO # display the primes #
|
||||
print( ( " ", whole( primes[ i ], -8 ) ) );
|
||||
IF i MOD 10 = 0 THEN print( ( newline ) ) FI
|
||||
|
|
|
|||
17
Task/Ascending-primes/NewLISP/ascending-primes.l
Normal file
17
Task/Ascending-primes/NewLISP/ascending-primes.l
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(define (prime? n) (= 1 (length (factor (int n)))))
|
||||
|
||||
(define (powerset lst)
|
||||
(if lst
|
||||
(let (p (powerset (1 lst)))
|
||||
(append p (map (curry cons (lst 0)) p)))
|
||||
'(())))
|
||||
|
||||
(letn (primes
|
||||
(sort (filter prime?
|
||||
(map (fn (xs) (int (apply string (sort xs)) 0))
|
||||
(powerset (sequence 1 9)))))
|
||||
cnt)
|
||||
(dolist (n primes)
|
||||
(print (format "%9d" n))
|
||||
(if (zero? (% (++ cnt) 6)) (println)))
|
||||
(println "\n\nNumber found: " (length primes)))
|
||||
10
Task/Ascending-primes/PascalABC.NET/ascending-primes.pas
Normal file
10
Task/Ascending-primes/PascalABC.NET/ascending-primes.pas
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
##
|
||||
uses School;
|
||||
|
||||
function AscendingSeq(n: integer): sequence of integer;
|
||||
begin
|
||||
for var x := n*10 + n mod 10 + 1 to n*10 + 9 do
|
||||
yield sequence AscendingSeq(x) + x;
|
||||
end;
|
||||
|
||||
AscendingSeq(0).Order.Where(n -> n.IsPrime).Print;
|
||||
Loading…
Add table
Add a link
Reference in a new issue