Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
numbers = [12, 1210, 1300, 2020, 21200, 5]
|
||||
|
||||
occurrences = function(test, values)
|
||||
count = 0
|
||||
for i in values
|
||||
if i.val == test then count = count + 1
|
||||
end for
|
||||
return count
|
||||
end function
|
||||
|
||||
for number in numbers
|
||||
check = "" + number
|
||||
digits = check.values
|
||||
describing = true
|
||||
for digit in digits.indexes
|
||||
if digits[digit].val != occurrences(digit, digits) then
|
||||
describing = false
|
||||
end if
|
||||
end for
|
||||
if describing then
|
||||
print number + " is self describing"
|
||||
else
|
||||
print number + " is not self describing"
|
||||
end if
|
||||
end for
|
||||
Loading…
Add table
Add a link
Reference in a new issue