31 lines
750 B
Plaintext
31 lines
750 B
Plaintext
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
|