?

Log in

No account? Create an account

7.Май, 2019


Previous Entry Поделиться Next Entry
08:09 - perlweeklychallenge
Challenge #1

Print all the niven numbers from 0 to 50 inclusive, each on their own line. A niven number is a non-negative number that is divisible by the sum of its digits.



# perl -le 'print join"\n",map{$_%(eval join"+",split"",$_)?():$_}1..50'   
1
2
3
4
5
6
7
8
9
10
12
18
20
21
24
27
30
36
40
42
45
48
50


Tags:

(Оставить комментарий)

perlweeklychallenge - Записки проperl — ЖЖ

> Свежие записи
> Архив
> Друзья
> Личная информация


> Go to Top
LiveJournal.com