Skip to content

Commit

Permalink
adding more runs
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Jan 13, 2025
1 parent 3e886e6 commit 6d70942
Show file tree
Hide file tree
Showing 11 changed files with 2,077 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.7
1.4.8
28 changes: 28 additions & 0 deletions runs/collatz-conjecture.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
% Collatz conjecture
% See https://en.wikipedia.org/wiki/Collatz_conjecture

:- use_module(library(between)).
:- use_module(library(format)).

'urn:example:collatz'(N, L) :-
collatz(N, 1, L).

collatz(N, N, [N]) :-
!.
collatz(N0, N, [N0|J]) :-
( 0 =:= N0 rem 2
-> N1 is N0 // 2
; N1 is 3 * N0 + 1
),
collatz(N1, N, J).

% query
query('urn:example:collatz'(N, _)) :-
between(1, 2048, N).

run :-
query(Q),
Q,
portray_clause(Q),
fail;
halt.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2,048 changes: 2,048 additions & 0 deletions runs/output/collatz-conjecture.pl

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6d70942

Please sign in to comment.