Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -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) }

View file

@ -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}";
}