Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,16 @@
|
|||
func sdn(n) {
|
||||
var b = [0]*n.len;
|
||||
var a = n.chars;
|
||||
a.each { |i| b[i] := 0 ++ }
|
||||
a.join == b.join;
|
||||
}
|
||||
|
||||
var values = <1210 2020 21200 3211000
|
||||
42101000 521001000 6210001000 27 115508>;
|
||||
|
||||
values.each { |test|
|
||||
say "#{test} is #{sdn(test) ? '' : 'NOT ' }a self describing number.";
|
||||
}
|
||||
|
||||
say "\nSelf-descriptive numbers less than 1e5 (in base 10):"
|
||||
0.to(1e5).each { |i| say i if sdn(i.to_s) }
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
7.to(36).each { |b|
|
||||
var n = ((b-4) * b**(b-1) + 2*(b**(b-2)) + b**(b-3) + b**3 -> base(b));
|
||||
say "base #{'%2d' % b}: #{n}";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue