Gapful numbers: Difference between revisions
Content added Content deleted
(Added Quackery.) |
No edit summary |
||
Line 1,294: | Line 1,294: | ||
num = num + 1 |
num = num + 1 |
||
} |
} |
||
p |
|||
println[] // Linkbreak |
|||
rintln[] // Linkbreak |
|||
} |
} |
||
Line 1,311: | Line 1,315: | ||
First 10 gapful numbers over 1000000000: |
First 10 gapful numbers over 1000000000: |
||
1000000000 1000000001 1000000005 1000000008 1000000010 1000000016 1000000020 1000000027 1000000030 1000000032 |
1000000000 1000000001 1000000005 1000000008 1000000010 1000000016 1000000020 1000000027 1000000030 1000000032 |
||
</pre> |
|||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
include "NSLog.incl" |
|||
_0 = 48 // ASCII code for 0 = 48 |
|||
void local fn GenerateGaps( start as UInt64, count as NSInteger ) |
|||
NSInteger counter = 0 |
|||
UInt64 i = start |
|||
NSLog( @"First %d Gapful numbers >= %llu:", count, start ) |
|||
while ( counter < count ) |
|||
CFStringRef string = fn StringWithFormat( @"%llu", i ) |
|||
UniChar character = fn StringCharacterAtIndex( string, 0 ) |
|||
if( ( i mod ( 10 * ( character - _0 ) + i mod 10 ) ) == 0 ) |
|||
NSLog( @"%3d : %llu", counter + 1, i ) |
|||
counter++ |
|||
end if |
|||
i++ |
|||
wend |
|||
end fn |
|||
local fn DoIt |
|||
fn generateGaps( 100, 30 ) : NSLog( @"\n" ) |
|||
fn generateGaps( 1000000, 15 ) : NSLog( @"\n" ) |
|||
fn generateGaps( 1000000000, 15 ) : NSLog( @"\n" ) |
|||
end fn |
|||
fn DoIt |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
{{output}} |
|||
<pre> |
|||
First 30 Gapful numbers >= 100: |
|||
1 : 100 |
|||
2 : 105 |
|||
3 : 108 |
|||
4 : 110 |
|||
5 : 120 |
|||
6 : 121 |
|||
7 : 130 |
|||
8 : 132 |
|||
9 : 135 |
|||
10 : 140 |
|||
11 : 143 |
|||
12 : 150 |
|||
13 : 154 |
|||
14 : 160 |
|||
15 : 165 |
|||
16 : 170 |
|||
17 : 176 |
|||
18 : 180 |
|||
19 : 187 |
|||
20 : 190 |
|||
21 : 192 |
|||
22 : 195 |
|||
23 : 198 |
|||
24 : 200 |
|||
25 : 220 |
|||
26 : 225 |
|||
27 : 231 |
|||
28 : 240 |
|||
29 : 242 |
|||
30 : 253 |
|||
First 15 Gapful numbers >= 1000000: |
|||
1 : 1000000 |
|||
2 : 1000005 |
|||
3 : 1000008 |
|||
4 : 1000010 |
|||
5 : 1000016 |
|||
6 : 1000020 |
|||
7 : 1000021 |
|||
8 : 1000030 |
|||
9 : 1000032 |
|||
10 : 1000034 |
|||
11 : 1000035 |
|||
12 : 1000040 |
|||
13 : 1000050 |
|||
14 : 1000060 |
|||
15 : 1000065 |
|||
First 15 Gapful numbers >= 1000000000: |
|||
1 : 1000000000 |
|||
2 : 1000000001 |
|||
3 : 1000000005 |
|||
4 : 1000000008 |
|||
5 : 1000000010 |
|||
6 : 1000000016 |
|||
7 : 1000000020 |
|||
8 : 1000000027 |
|||
9 : 1000000030 |
|||
10 : 1000000032 |
|||
11 : 1000000035 |
|||
12 : 1000000039 |
|||
13 : 1000000040 |
|||
14 : 1000000050 |
|||
15 : 1000000053 |
|||
</pre> |
</pre> |
||