Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,39 @@
|
|||
local fn DigitSum( n as UInt64, sum as UInt64 ) as UInt64
|
||||
sum++
|
||||
while ( n > 0 and n mod 10 == 0 )
|
||||
sum -= 9
|
||||
n = n / 10
|
||||
wend
|
||||
end fn = sum
|
||||
|
||||
|
||||
local fn IsDivisible( n as UInt64, d as UInt64 ) as BOOL
|
||||
BOOL result
|
||||
|
||||
if ( ( d and 1 ) == 0 and ( n and 1 ) == 1 ) then result = NO : exit fn
|
||||
result = n mod d == 0
|
||||
end fn = result
|
||||
|
||||
local fn DoIt
|
||||
UInt64 niven, previous = 1, gap = 0, sum = 0
|
||||
long niven_index = 0, gap_index = 1
|
||||
|
||||
printf( @"Index Gap Niven index Niven number" )
|
||||
printf( @"----- --- ----------- ------------" )
|
||||
for niven = 1 to gap_index <= 24
|
||||
sum = fn DigitSum( niven, sum )
|
||||
if ( fn IsDivisible( niven, sum ) )
|
||||
if ( niven > previous + gap )
|
||||
gap = niven - previous
|
||||
printf @"%3d %6llu %13d %15llu", gap_index, gap, niven_index, previous
|
||||
gap_index++
|
||||
end if
|
||||
previous = niven
|
||||
niven_index++
|
||||
end if
|
||||
next
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue