Double Twin Primes: Difference between revisions

Initial FutureBasic task solution added
(J)
(Initial FutureBasic task solution added)
Line 368:
191 193 197 199
821 823 827 829</pre>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
local fn IsPrime( n as long ) as BOOL
long i
BOOL result = YES
if ( n < 2 ) then result = NO : exit fn
for i = 2 to n + 1
if ( i * i <= n ) and ( n mod i == 0 )
result = NO : exit fn
end if
next
end fn = result
 
local fn DoubleTwinPrimes( limit as long )
NSUInteger num = 3
printf @"Double twin primes < %ld:", limit
do
if fn IsPrime( num )
if fn IsPrime( num + 2 )
if fn IsPrime( num + 6 )
if fn IsPrime( num + 8 ) then printf @"%4lu%7lu%7lu%7lu", num, num + 2, num + 6, num + 8
end if
end if
end if
num += 2
until ( num > limit )
end fn
 
fn DoubleTwinPrimes( 2000 )
 
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
Double twin primes < 2000:
5 7 11 13
11 13 17 19
101 103 107 109
191 193 197 199
821 823 827 829
1481 1483 1487 1489
1871 1873 1877 1879
</pre>
 
 
=={{header|Go}}==
717

edits