Honaker primes

From Rosetta Code
Revision as of 11:56, 21 September 2022 by Nigel Galloway (talk | contribs) (Realize in F#)
Honaker primes is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

A Honaker prime is a prime whose digital sum is equal to the digital sum of its position in the sequence of primes.


E.G.

If you look at the sequence of positive integer primes the first prime is 2 at position 1. The digital sums of 2 and 1 are not equal, so 2 is not a Honaker prime. The prime at position 32: 131 is a Honaker prime. The digital sum of 32 (5) is equal to the digital sum of 131 (5).


Task
  • Write a routine (procedure, function, filter, whatever it may be called in your language) to identify Honaker primes.
  • Use that routine to find the first fifty Honaker primes and display the position and value for each.


Stretch
  • Find and display the ten thousandth Honaker prime (position and value).


See also


ALGOL 68

Constructs a sieve of primes and table of digit sums. Note: if running this with ALGOL 68G, you will need to specify a large heap size on the command line (for Windows and probably other operating systems), e.g.: -heap 256M.

BEGIN # find some Honaker primes: primes whose digit-sum equals the   #
      # digit-sum of the index of the prime in the list of primes     #
      # e.g.: prime 32 (dsum 5) = 131 (dsum 5)                        #
    INT h count    :=  0; # number of Honaker primes found so far     #
    # sieve the primes up to 5 000 000, hopefully enough...           #
    [ 0 : 5 000 000 ]BOOL prime;
    prime[ 0 ] := prime[ 1 ] := FALSE;
    prime[ 2 ] := TRUE;
    FOR i FROM 3 BY 2 TO UPB prime DO prime[ i ] := TRUE  OD;
    FOR i FROM 4 BY 2 TO UPB prime DO prime[ i ] := FALSE OD;
    FOR i FROM 3 BY 2 TO ENTIER sqrt( UPB prime ) DO
        IF prime[ i ] THEN
            FOR s FROM i * i BY i + i TO UPB prime DO prime[ s ] := FALSE OD
        FI
    OD;
    # construct the digit sums of the numbers up to 4 999 999         #
    [ 0 : UPB prime ]INT dsum; FOR i FROM LWB dsum TO UPB dsum DO dsum[ i ] := 0 OD;
    INT un := 0, tn := 0, hn := 0, th := 0, tt := 0,  ht := 0, mi := 0, dpos := -1;
    WHILE mi /= 5 DO
        dsum[ dpos +:= 1 ] := mi + ht + tt + th + hn + tn + un;
        un +:= 1;
        IF un > 9 THEN
            un  := 0;
            tn +:= 1;
            IF tn > 9 THEN
                tn  := 0;
                hn +:= 1;
                IF hn > 9 THEN
                    hn  := 0;
                    th +:= 1;
                    IF th > 9 THEN
                        th  := 0;
                        tt +:= 1;
                        IF tt > 9 THEN
                            tt  := 0;
                            ht +:= 1;
                            IF ht > 9 THEN
                                ht  := 0;
                                mi +:= 1
                            FI
                        FI
                    FI
                FI
            FI
        FI
    OD;
    # attempt to find the Honaker primes                               #
    INT p count := 0;
    FOR n FROM LWB prime TO UPB prime DO
        IF prime[ n ] THEN
            # have the p count'th prime                                #
            p count +:= 1;
            IF dsum[ n ] = dsum[ p count ] THEN
                # have a Honaker prime                                 #
                IF ( h count +:= 1 ) < 51 THEN
                    print( ( "(",  whole( h count, -2 )
                           , ": ", whole( p count, -3 )
                           , " ",  whole( n,       -4 )
                           , ") "
                           )
                         );
                    IF h count MOD 5 = 0 THEN print( ( newline ) ) FI
                ELIF h count = 10 000 THEN
                    print( ( newline
                           , "Honaker prime ", whole( h count, 0 )
                           , " is prime ",     whole( p count, 0 )
                           , ": ",             whole( n,       0 )
                           , newline
                           )
                         )
                FI
            FI
        FI
    OD
END
Output:
( 1:  32  131) ( 2:  56  263) ( 3:  88  457) ( 4: 175 1039) ( 5: 176 1049)
( 6: 182 1091) ( 7: 212 1301) ( 8: 218 1361) ( 9: 227 1433) (10: 248 1571)
(11: 293 1913) (12: 295 1933) (13: 323 2141) (14: 331 2221) (15: 338 2273)
(16: 362 2441) (17: 377 2591) (18: 386 2663) (19: 394 2707) (20: 397 2719)
(21: 398 2729) (22: 409 2803) (23: 439 3067) (24: 446 3137) (25: 457 3229)
(26: 481 3433) (27: 499 3559) (28: 508 3631) (29: 563 4091) (30: 571 4153)
(31: 595 4357) (32: 599 4397) (33: 635 4703) (34: 637 4723) (35: 655 4903)
(36: 671 5009) (37: 728 5507) (38: 751 5701) (39: 752 5711) (40: 755 5741)
(41: 761 5801) (42: 767 5843) (43: 779 5927) (44: 820 6301) (45: 821 6311)
(46: 826 6343) (47: 827 6353) (48: 847 6553) (49: 848 6563) (50: 857 6653)

Honaker prime 10000 is prime 286069: 4043749

F#

This task uses Extensible Prime Generator (F#)

// Honaker primes. Nigel Galloway: September 21st., 2022
let rec fG n g=if n<10 then n+g else fG(n/10)(g+n%10)
let Honaker()=primes32()|>Seq.mapi(fun n g->(n+1,g,fG g 0,fG (n+1) 0))|>Seq.choose(fun(i,g,e,l)->if e=l then Some(i,g) else None)
Honaker()|>Seq.chunkBySize 10|>Seq.take 5|>Seq.iter(fun g->g|>Seq.iter(printf "%A "); printfn "")
printfn "%A" (Seq.item 9999 (Honaker()))
Output:
(32, 131) (56, 263) (88, 457) (175, 1039) (176, 1049) (182, 1091) (212, 1301) (218, 1361) (227, 1433) (248, 1571)
(293, 1913) (295, 1933) (323, 2141) (331, 2221) (338, 2273) (362, 2441) (377, 2591) (386, 2663) (394, 2707) (397, 2719) 
(398, 2729) (409, 2803) (439, 3067) (446, 3137) (457, 3229) (481, 3433) (499, 3559) (508, 3631) (563, 4091) (571, 4153) 
(595, 4357) (599, 4397) (635, 4703) (637, 4723) (655, 4903) (671, 5009) (728, 5507) (751, 5701) (752, 5711) (755, 5741) 
(761, 5801) (767, 5843) (779, 5927) (820, 6301) (821, 6311) (826, 6343) (827, 6353) (847, 6553) (848, 6563) (857, 6653)

(286069, 4043749)

Factor

Works with: Factor version 0.99 2022-04-03
USING: grouping kernel lists lists.lazy math math.primes.lists
prettyprint sequences ;

: sum-digits ( n -- sum )
    0 swap [ 10 /mod rot + swap ] until-zero ;

: honaker ( -- list )
    1 lfrom lprimes lzip [ first2 [ sum-digits ] same? ] lfilter ;

50 honaker ltake list>array 5 group simple-table.
Output:
{ 32 131 }   { 56 263 }   { 88 457 }   { 175 1039 } { 176 1049 }
{ 182 1091 } { 212 1301 } { 218 1361 } { 227 1433 } { 248 1571 }
{ 293 1913 } { 295 1933 } { 323 2141 } { 331 2221 } { 338 2273 }
{ 362 2441 } { 377 2591 } { 386 2663 } { 394 2707 } { 397 2719 }
{ 398 2729 } { 409 2803 } { 439 3067 } { 446 3137 } { 457 3229 }
{ 481 3433 } { 499 3559 } { 508 3631 } { 563 4091 } { 571 4153 }
{ 595 4357 } { 599 4397 } { 635 4703 } { 637 4723 } { 655 4903 }
{ 671 5009 } { 728 5507 } { 751 5701 } { 752 5711 } { 755 5741 }
{ 761 5801 } { 767 5843 } { 779 5927 } { 820 6301 } { 821 6311 }
{ 826 6343 } { 827 6353 } { 847 6553 } { 848 6563 } { 857 6653 }

FreeBASIC

' version 20-09-2022
' compile with: fbc -s console

Function dig_sum(n As UInteger) As UInteger

    Dim As UInteger sum

    While n > 0
        sum += n Mod 10
        n \= 10
    Wend

    Return sum

End Function

' ------=< MAIN >=------

#Define max 5 * 10^6

Dim As UInteger x, y, place, rank = 1
Dim Shared As UInteger prime(max)

For x = 3 To max Step 2
    If prime(x) = 0 Then
        For y = x * x To max Step x + x
            prime(y) = 1
        Next
    End If
Next

For x = 3 To max Step 2
    If prime(x) = 0 Then
        rank += 1
        If rank Mod 9 = x Mod 9 Then
            If dig_sum(rank) = dig_sum(x) Then
                place += 1
                If place <= 50 Then
                    Print Using "   ##: ### #####"; place ; rank ; x;
                    If (place Mod 5) = 0 Then Print
                End If
                If place = 10000 Then
                    Print
                    Print "   10000th honaker prime is at ";rank; " and is ";x
                End If
            End If
        End If
    End If
Next


' empty keyboard buffer
While Inkey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End
Output:
    1:  32   131    2:  56   263    3:  88   457    4: 175  1039    5: 176  1049
    6: 182  1091    7: 212  1301    8: 218  1361    9: 227  1433   10: 248  1571
   11: 293  1913   12: 295  1933   13: 323  2141   14: 331  2221   15: 338  2273
   16: 362  2441   17: 377  2591   18: 386  2663   19: 394  2707   20: 397  2719
   21: 398  2729   22: 409  2803   23: 439  3067   24: 446  3137   25: 457  3229
   26: 481  3433   27: 499  3559   28: 508  3631   29: 563  4091   30: 571  4153
   31: 595  4357   32: 599  4397   33: 635  4703   34: 637  4723   35: 655  4903
   36: 671  5009   37: 728  5507   38: 751  5701   39: 752  5711   40: 755  5741
   41: 761  5801   42: 767  5843   43: 779  5927   44: 820  6301   45: 821  6311
   46: 826  6343   47: 827  6353   48: 847  6553   49: 848  6563   50: 857  6653

   10000th honaker prime is at 286069 and is 4043749

Haskell

import Control.Monad (join)
import Data.Bifunctor (bimap)
import Data.List.Split (chunksOf)
import Data.Numbers.Primes (primes)

---------------------- HONAKER PRIMES --------------------

honakers :: [(Integer, Integer)]
honakers =
  filter
    (uncurry (==) . both sumDigits)
    (zip [1 ..] primes)

--------------------------- TEST -------------------------
main :: IO ()
main = do
  putStrLn "First Fifty:\n"
  mapM_ (putStrLn . unwords) $
    chunksOf 5 $
      take 50 (show <$> honakers)
      
  putStrLn "\n10Kth:\n"
  print $ honakers !! pred 10000

------------------------- GENERIC ------------------------
sumDigits :: Integer -> Integer
sumDigits = foldr ((+) . read . return) 0 . show

both :: (a -> b) -> (a, a) -> (b, b)
both = join bimap
Output:
First Fifty:

(32,131) (56,263) (88,457) (175,1039) (176,1049)
(182,1091) (212,1301) (218,1361) (227,1433) (248,1571)
(293,1913) (295,1933) (323,2141) (331,2221) (338,2273)
(362,2441) (377,2591) (386,2663) (394,2707) (397,2719)
(398,2729) (409,2803) (439,3067) (446,3137) (457,3229)
(481,3433) (499,3559) (508,3631) (563,4091) (571,4153)
(595,4357) (599,4397) (635,4703) (637,4723) (655,4903)
(671,5009) (728,5507) (751,5701) (752,5711) (755,5741)
(761,5801) (767,5843) (779,5927) (820,6301) (821,6311)
(826,6343) (827,6353) (847,6553) (848,6563) (857,6653)

10Kth:

(286069,4043749)

J

Implementation:

honk=: >: =&(+/@(10&#.inv))"0 p:

This tests a sequence of prime indices to determine whether the corresponding prime is a honaker prime. Here, >: adds 1 (since J indices start with 0 and Honaker prime indices start with 1). Also, p: yields the prime for an index, and +/@(10&#.inv) computes a digital sum of a number (but not a sequence, so we use "0 to map it onto sequences). So, =&(+/@(10&#.inv))"0 identifies members of a pair of sequences (one on the left, the other on the right) whose digital primes match.

Task example:

   (>: j. p:) 5 10$I.honk i.1e3
  32j131   56j263   88j457 175j1039 176j1049 182j1091 212j1301 218j1361 227j1433 248j1571
293j1913 295j1933 323j2141 331j2221 338j2273 362j2441 377j2591 386j2663 394j2707 397j2719
398j2729 409j2803 439j3067 446j3137 457j3229 481j3433 499j3559 508j3631 563j4091 571j4153
595j4357 599j4397 635j4703 637j4723 655j4903 671j5009 728j5507 751j5701 752j5711 755j5741
761j5801 767j5843 779j5927 820j6301 821j6311 826j6343 827j6353 847j6553 848j6563 857j6653

Here, we test the first thousand primes to see which are prime indices of Honaker primes. Then I.converts the test results back to index form, and 5 10$I. organizes those indices in 5 rows of 10 columns (discarding any extra). Finally, we use complex number notation to form pairs of the corresponding honaker index and prime.


Julia

""" Rosetta code task: rosettacode.org/wiki/Honaker_primes """

using Formatting
using Primes

""" Get the sequence of Honaker primes as tuples with their primepi values first in tuple"""
honaker(N, lim) = [(i, p) for (i, p) in enumerate(primes(lim)) if sum(digits(p)) == sum(digits(i))]

println("First 50 Honaker primes:")
const a = honaker(10_000, 5_000_000)
foreach(p -> print(rpad(p[2], 12), p[1] % 5 == 0 ? "\n" : ""), enumerate(a[1:50]))
println("\n$(format(a[10000][2], commas = true)) is the ",
        "$(format(a[10000][1], commas = true))th prime and the 10,000th Honaker prime.")
Output:
First 50 Honaker primes:
(32, 131)   (56, 263)   (88, 457)   (175, 1039) (176, 1049) 
(182, 1091) (212, 1301) (218, 1361) (227, 1433) (248, 1571) 
(293, 1913) (295, 1933) (323, 2141) (331, 2221) (338, 2273) 
(362, 2441) (377, 2591) (386, 2663) (394, 2707) (397, 2719) 
(398, 2729) (409, 2803) (439, 3067) (446, 3137) (457, 3229) 
(481, 3433) (499, 3559) (508, 3631) (563, 4091) (571, 4153) 
(595, 4357) (599, 4397) (635, 4703) (637, 4723) (655, 4903) 
(671, 5009) (728, 5507) (751, 5701) (752, 5711) (755, 5741) 
(761, 5801) (767, 5843) (779, 5927) (820, 6301) (821, 6311) 
(826, 6343) (827, 6353) (847, 6553) (848, 6563) (857, 6653) 

4,043,749 is the 286,069th prime and the 10,000th Honaker prime.

Phix

with javascript_semantics

function digital_sum(integer i)
    integer res = 0
    while i do
        res += remainder(i,10)
        i = floor(i/10)
    end while
    return res
end function

sequence res = {}
integer pdx = 1, p
while length(res)<10_000 do
    p = get_prime(pdx)
    if digital_sum(p)=digital_sum(pdx) then
        res = append(res,{pdx,p})
    end if
    pdx += 1
end while
string r = join_by(apply(true,sprintf,{{"(%3d,%4d)"},res[1..50]}),1,10," ")
printf(1,"First 50 Honaker primes (index, prime):\n%s\n",{r})
{pdx,p} = res[10000]
printf(1,"The %,d%s prime is %,d which is the 10,000th Honaker prime\n",{pdx,ord(pdx),p})
Output:
First 50 Honaker primes (index, prime):
( 32, 131) ( 56, 263) ( 88, 457) (175,1039) (176,1049) (182,1091) (212,1301) (218,1361) (227,1433) (248,1571)
(293,1913) (295,1933) (323,2141) (331,2221) (338,2273) (362,2441) (377,2591) (386,2663) (394,2707) (397,2719)
(398,2729) (409,2803) (439,3067) (446,3137) (457,3229) (481,3433) (499,3559) (508,3631) (563,4091) (571,4153)
(595,4357) (599,4397) (635,4703) (637,4723) (655,4903) (671,5009) (728,5507) (751,5701) (752,5711) (755,5741)
(761,5801) (767,5843) (779,5927) (820,6301) (821,6311) (826,6343) (827,6353) (847,6553) (848,6563) (857,6653)

The 286,069th prime is 4,043,749 which is the 10,000th Honaker prime

Python

''' Rosetta code task: rosettacode.org/wiki/Honaker_primes '''


from pyprimesieve import primes


def digitsum(num):
    ''' Digit sum of an integer (base 10) '''
    return sum(int(c) for c in str(num))


def generate_honaker(limit=5_000_000):
    ''' Generate the sequence of Honaker primes with their sequence and primepi values '''
    honaker = [(i + 1, p) for i, p in enumerate(primes(limit)) if digitsum(p) == digitsum(i + 1)]
    for hcount, (ppi, pri) in enumerate(honaker):
        yield hcount + 1, ppi, pri


print('First 50 Honaker primes:')
for p in generate_honaker():
    if p[0] < 51:
        print(f'{str(p):16}', end='\n' if p[0] % 5 == 0 else '')
    elif p[0] == 10_000:
        print(f'\nThe 10,000th Honaker prime is the {p[1]:,}th one, which is {p[2]:,}.')
        break
Output:
First 50 Honaker primes:
(1, 32, 131)    (2, 56, 263)    (3, 88, 457)    (4, 175, 1039)  (5, 176, 1049)  
(6, 182, 1091)  (7, 212, 1301)  (8, 218, 1361)  (9, 227, 1433)  (10, 248, 1571) 
(11, 293, 1913) (12, 295, 1933) (13, 323, 2141) (14, 331, 2221) (15, 338, 2273) 
(16, 362, 2441) (17, 377, 2591) (18, 386, 2663) (19, 394, 2707) (20, 397, 2719) 
(21, 398, 2729) (22, 409, 2803) (23, 439, 3067) (24, 446, 3137) (25, 457, 3229) 
(26, 481, 3433) (27, 499, 3559) (28, 508, 3631) (29, 563, 4091) (30, 571, 4153) 
(31, 595, 4357) (32, 599, 4397) (33, 635, 4703) (34, 637, 4723) (35, 655, 4903) 
(36, 671, 5009) (37, 728, 5507) (38, 751, 5701) (39, 752, 5711) (40, 755, 5741) 
(41, 761, 5801) (42, 767, 5843) (43, 779, 5927) (44, 820, 6301) (45, 821, 6311) 
(46, 826, 6343) (47, 827, 6353) (48, 847, 6553) (49, 848, 6563) (50, 857, 6653) 

The 10,000th Honaker prime is the 286,069th one, which is 4,043,749.


Or, a variant without sympy:

'''Honaker primes'''

from itertools import chain, count, islice
from functools import reduce


def honakers():
    '''Infinite stream of Honaker terms,
       tupled with their 1-based indices.
    '''
    def f(ip):
        return [ip] if (
            digitSum(ip[0]) == digitSum(ip[1])
        ) else []

    return chain.from_iterable(
        map(f, zip(count(1), primes()))
    )


# digitSum :: Int -> Int
def digitSum(n):
    '''Sum of the decimal digits of the given integer.
    '''
    return reduce(
        lambda a, c: a + int(c),
        str(n),
        0
    )


# ------------------------- TEST -------------------------
# main :: IO ()
def main():
    '''Test'''
    print("First 50:\n")
    for xs in (
        chunksOf(5)(
            list(
                islice(
                    honakers(),
                    50
                )
            )
        )
    ):
        print(" ".join(repr(x) for x in xs))

    print("\n10Kth:\n")
    print(
        next(islice(honakers(), 10000-1, None))
    )


# ----------------------- GENERIC ------------------------

# chunksOf :: Int -> [a] -> [[a]]
def chunksOf(n):
    '''A series of lists of length n, subdividing the
       contents of xs. Where the length of xs is not evenly
       divisible, the final list will be shorter than n.
    '''
    def go(xs):
        return (
            xs[i:n + i] for i in range(0, len(xs), n)
        ) if 0 < n else None
    return go


# primes :: [Int]
def primes():
    '''An infinite stream of primes.
    '''
    seen = {}
    p = None
    yield 2
    for q in count(3, 2):
        p = seen.pop(q, None)
        if p is None:
            seen[q ** 2] = q
            yield q
        else:
            seen[
                until(lambda x: x not in seen)(
                    lambda x: x + 2 * p
                )(q + 2 * p)
            ] = p


# until :: (a -> Bool) -> (a -> a) -> a -> a
def until(p):
    '''The result of repeatedly applying f until p holds.
       The initial seed value is x.
    '''
    def go(f):
        def g(x):
            v = x
            while not p(v):
                v = f(v)
            return v
        return g
    return go


# MAIN ---
if __name__ == '__main__':
    main()
Output:
First 50:

(32, 131) (56, 263) (88, 457) (175, 1039) (176, 1049)
(182, 1091) (212, 1301) (218, 1361) (227, 1433) (248, 1571)
(293, 1913) (295, 1933) (323, 2141) (331, 2221) (338, 2273)
(362, 2441) (377, 2591) (386, 2663) (394, 2707) (397, 2719)
(398, 2729) (409, 2803) (439, 3067) (446, 3137) (457, 3229)
(481, 3433) (499, 3559) (508, 3631) (563, 4091) (571, 4153)
(595, 4357) (599, 4397) (635, 4703) (637, 4723) (655, 4903)
(671, 5009) (728, 5507) (751, 5701) (752, 5711) (755, 5741)
(761, 5801) (767, 5843) (779, 5927) (820, 6301) (821, 6311)
(826, 6343) (827, 6353) (847, 6553) (848, 6563) (857, 6653)

10Kth:

(286069, 4043749)

Raku

my @honaker = lazy (^∞).hyper.grep(&is-prime).kv.grep: (1 + *).comb.sum == *.comb.sum;

say "First 50 Honaker primes (index, prime):\n" ~ @honaker[^50].map(&format).batch(5).join: "\n";
say "\nTen thousandth: " ~ @honaker[9999].&format;

sub format ($_) { sprintf "(%3d, %4d)", 1 + .[0], .[1] }
Output:
First 50 Honaker primes (index, prime):
( 32,  131) ( 56,  263) ( 88,  457) (175, 1039) (176, 1049)
(182, 1091) (212, 1301) (218, 1361) (227, 1433) (248, 1571)
(293, 1913) (295, 1933) (323, 2141) (331, 2221) (338, 2273)
(362, 2441) (377, 2591) (386, 2663) (394, 2707) (397, 2719)
(398, 2729) (409, 2803) (439, 3067) (446, 3137) (457, 3229)
(481, 3433) (499, 3559) (508, 3631) (563, 4091) (571, 4153)
(595, 4357) (599, 4397) (635, 4703) (637, 4723) (655, 4903)
(671, 5009) (728, 5507) (751, 5701) (752, 5711) (755, 5741)
(761, 5801) (767, 5843) (779, 5927) (820, 6301) (821, 6311)
(826, 6343) (827, 6353) (847, 6553) (848, 6563) (857, 6653)

Ten thousandth: (286069, 4043749)

Wren

Library: Wren-math
Library: Wren-fmt
import "./math" for Int
import "./fmt" for Fmt

var primes = Int.primeSieve(5 * 1e6)
var i = 1
var count = 0
var h = []
var h10000
while (true) {
    if (Int.digitSum(i) == Int.digitSum(primes[i-1])) {
        count = count + 1
        if (count <= 50) {
            h.add([i, primes[i-1]])
        } else  if (count == 10000) {
            h10000 = [i, primes[i-1]]
            break
        }
    }
    i = i + 1
}
System.print("The first 50 Honecker primes (index, prime):")
for (i in 0..49) {
    Fmt.write("($3d, $,5d) ", h[i][0], h[i][1])
    if ((i + 1) % 5 == 0) System.print()
}
Fmt.print("\nand the 10,000th: ($,7d, $,9d)", h10000[0], h10000[1])
Output:
The first 50 Honecker primes (index, prime):
( 32,   131) ( 56,   263) ( 88,   457) (175, 1,039) (176, 1,049) 
(182, 1,091) (212, 1,301) (218, 1,361) (227, 1,433) (248, 1,571) 
(293, 1,913) (295, 1,933) (323, 2,141) (331, 2,221) (338, 2,273) 
(362, 2,441) (377, 2,591) (386, 2,663) (394, 2,707) (397, 2,719) 
(398, 2,729) (409, 2,803) (439, 3,067) (446, 3,137) (457, 3,229) 
(481, 3,433) (499, 3,559) (508, 3,631) (563, 4,091) (571, 4,153) 
(595, 4,357) (599, 4,397) (635, 4,703) (637, 4,723) (655, 4,903) 
(671, 5,009) (728, 5,507) (751, 5,701) (752, 5,711) (755, 5,741) 
(761, 5,801) (767, 5,843) (779, 5,927) (820, 6,301) (821, 6,311) 
(826, 6,343) (827, 6,353) (847, 6,553) (848, 6,563) (857, 6,653) 

and the 10,000th: (286,069, 4,043,749)