Data update
This commit is contained in:
parent
0df55f9f24
commit
aec8ed51b6
1045 changed files with 18889 additions and 2777 deletions
14
Task/Tau-number/Applesoft-BASIC/tau-number.basic
Normal file
14
Task/Tau-number/Applesoft-BASIC/tau-number.basic
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
100 HOME
|
||||
110 PRINT "The first 100 tau numbers are:"
|
||||
120 N = 0
|
||||
130 NUM = 0
|
||||
140 LIMIT = 100
|
||||
150 IF NUM >= LIMIT THEN GOTO 230
|
||||
160 N = N+1
|
||||
170 TAU = 0
|
||||
180 FOR M = 1 TO N
|
||||
190 IF N - INT(N/M) * M = 0 THEN TAU = TAU+1
|
||||
200 NEXT M
|
||||
210 IF N - INT(N/TAU) * TAU = 0 THEN NUM = NUM+1 : PRINT N; " ";
|
||||
220 GOTO 150
|
||||
230 END
|
||||
15
Task/Tau-number/Asymptote/tau-number.asymptote
Normal file
15
Task/Tau-number/Asymptote/tau-number.asymptote
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
int n = 0;
|
||||
int num = 0;
|
||||
int limit = 100;
|
||||
write("The first $limit tau numbers are:");
|
||||
do {
|
||||
++n;
|
||||
int tau = 0;
|
||||
for (int m = 1; m <= n; ++m) {
|
||||
if (n % m == 0) ++tau;
|
||||
}
|
||||
if (n % tau == 0) {
|
||||
++num;
|
||||
write(format("%5d", n), suffix=none);
|
||||
}
|
||||
} while (num < limit);
|
||||
26
Task/Tau-number/Dart/tau-number.dart
Normal file
26
Task/Tau-number/Dart/tau-number.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
int divisorCount(int n) {
|
||||
int total = 1;
|
||||
// Deal with powers of 2 first
|
||||
for (; (n & 1) == 0; n >>= 1) total++;
|
||||
// Odd prime factors up to the square root
|
||||
for (int p = 3; p * p <= n; p += 2) {
|
||||
int count = 1;
|
||||
for (; n % p == 0; n ~/= p) count++;
|
||||
total *= count;
|
||||
}
|
||||
// If n > 1 then it's prime
|
||||
if (n > 1) total *= 2;
|
||||
return total;
|
||||
}
|
||||
|
||||
void main() {
|
||||
const int limit = 100;
|
||||
print("The first $limit tau numbers are:");
|
||||
int count = 0;
|
||||
for (int n = 1; count < limit; n++) {
|
||||
if (n % divisorCount(n) == 0) {
|
||||
print(n.toString().padLeft(6));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
120 N = 0
|
||||
130 NUM = 0
|
||||
140 LIMIT = 100
|
||||
150 IF NUM > LIMIT THEN GOTO 270
|
||||
150 IF NUM > LIMIT THEN GOTO 230
|
||||
160 N = N+1
|
||||
170 TAU = 0
|
||||
180 FOR M = 1 TO N
|
||||
|
|
|
|||
19
Task/Tau-number/Minimal-BASIC/tau-number.basic
Normal file
19
Task/Tau-number/Minimal-BASIC/tau-number.basic
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
10 PRINT "THE FIRST 100 TAU NUMBERS ARE:"
|
||||
20 LET N = 0
|
||||
30 LET M = 0
|
||||
40 LET L = 100
|
||||
50 IF M >= L THEN 190
|
||||
60 LET N = N + 1
|
||||
70 LET T = 0
|
||||
80 FOR I = 1 TO N
|
||||
90 IF N - INT(N/I) * I = 0 THEN 110
|
||||
100 GOTO 120
|
||||
110 LET T = T + 1
|
||||
120 NEXT I
|
||||
130 IF N - INT(N/T) * T = 0 THEN 160
|
||||
140 GOTO 50
|
||||
150 STOP
|
||||
160 LET M = M + 1
|
||||
170 PRINT N;
|
||||
180 GOTO 140
|
||||
190 END
|
||||
13
Task/Tau-number/Prolog/tau-number.pro
Normal file
13
Task/Tau-number/Prolog/tau-number.pro
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
tau(N, T) :-
|
||||
findall(M, (between(1, N, M), 0 is N mod M), Ms),
|
||||
length(Ms, T).
|
||||
|
||||
tau_numbers(Limit, Ns) :-
|
||||
findall(N, (between(1, Limit, N), tau(N, T), 0 is N mod T), Ns).
|
||||
|
||||
print_tau_numbers :-
|
||||
tau_numbers(1100, Ns),
|
||||
writeln("The first 100 tau numbers are:"),
|
||||
forall(member(N, Ns), format("~d ", [N])).
|
||||
|
||||
:- print_tau_numbers.
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
10 let count = 0
|
||||
20 let num = 0
|
||||
30 let modulus = 0
|
||||
40 let nums = 100
|
||||
50 let tau = 0
|
||||
|
||||
60 rem do
|
||||
|
||||
70 let count = count + 1
|
||||
80 let tau = 0
|
||||
90 let modulus = 1
|
||||
|
||||
100 rem do
|
||||
|
||||
100 if count mod modulus <> 0 then 130
|
||||
|
||||
120 let tau = tau + 1
|
||||
|
||||
130 rem endif
|
||||
|
||||
140 let modulus = modulus + 1
|
||||
|
||||
150 if modulus < count + 1 then 100
|
||||
|
||||
160 if count mod tau <> 0 then 190
|
||||
|
||||
170 let num = num + 1
|
||||
180 print count, tab,
|
||||
|
||||
190 rem endif
|
||||
|
||||
200 if num < nums then 60
|
||||
Loading…
Add table
Add a link
Reference in a new issue