Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Gapful-numbers/AppleScript/gapful-numbers-1.applescript
Normal file
31
Task/Gapful-numbers/AppleScript/gapful-numbers-1.applescript
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
on isGapful(n)
|
||||
set units to n mod 10
|
||||
set temp to n div 10
|
||||
repeat until (temp < 10)
|
||||
set temp to temp div 10
|
||||
end repeat
|
||||
|
||||
return (n mod (temp * 10 + units) = 0)
|
||||
end isGapful
|
||||
|
||||
-- Task code:
|
||||
on getGapfuls(n, q)
|
||||
set collector to {}
|
||||
repeat until ((count collector) = q)
|
||||
if (isGapful(n)) then set end of collector to n
|
||||
set n to n + 1
|
||||
end repeat
|
||||
return collector
|
||||
end getGapfuls
|
||||
|
||||
local output, astid
|
||||
set output to {}
|
||||
set astid to AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to " "
|
||||
set end of output to "First 30 gapful numbers ≥ 100:" & linefeed & getGapfuls(100, 30)
|
||||
set end of output to "First 15 gapful numbers ≥ 1,000,000:" & linefeed & getGapfuls(1000000, 15)
|
||||
set end of output to "First 10 gapful numbers ≥ 100,000,000:" & linefeed & getGapfuls(1.0E+9, 10)
|
||||
set AppleScript's text item delimiters to linefeed & linefeed
|
||||
set output to output as text
|
||||
set AppleScript's text item delimiters to astid
|
||||
return output
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
"First 30 gapful numbers ≥ 100:
|
||||
100 105 108 110 120 121 130 132 135 140 143 150 154 160 165 170 176 180 187 190 192 195 198 200 220 225 231 240 242 253
|
||||
|
||||
First 15 gapful numbers ≥ 1,000,000:
|
||||
1000000 1000005 1000008 1000010 1000016 1000020 1000021 1000030 1000032 1000034 1000035 1000040 1000050 1000060 1000065
|
||||
|
||||
First 10 gapful numbers ≥ 1,000,000,000:
|
||||
1.0E+9 1.000000001E+9 1.000000005E+9 1.000000008E+9 1.00000001E+9 1.000000016E+9 1.00000002E+9 1.000000027E+9 1.00000003E+9 1.000000032E+9"
|
||||
Loading…
Add table
Add a link
Reference in a new issue