Triangle Of The Gods

November 10, 2015

This is a trick question. No such prime number is known, though it is conjectured that an infinite number of them exist. All terms of the sequence up to n = 270,000 have been tested and found to be composite. Here’s our program to generate and test elements of the sequence:

> (let loop ((i 1) (n 1))
    (display n) (newline)
    (if (prime? n) (display "PRIME!")
      (loop (+ i 1) (+ (* n (expt 10 (size (+ i 1)))) i 1))))
1
12
123
1234
...

You can run the program at http://ideone.com/hoYqVc, where you will also see the definitions of ilog, prime? and size.

Advertisement

Pages: 1 2

4 Responses to “Triangle Of The Gods”

  1. Francesco said

    Ok, I’ll be the first one to admit I got trolled :P

    Sequence generator:

    q :: [Integer]
    q = map (read . concatMap show . enumFromTo 1) [1..]
    
  2. FA said

    Scala:
    1. stream of Smarandache numbers
    2. stream of primes
    3. take te common elements

      def sqrt(number: BigInt) = {
        val one = BigInt(1)
        def next(n: BigInt, i: BigInt): BigInt = (n + i / n) >> 1
        var n = one
        var n1 = next(n, number)
        while ((n1 - n).abs > one) {
          n = n1
          n1 = next(n, number)
        }
        while (n1 * n1 > number) { n1 -= one }
        n1
      }                                               //> sqrt: (number: BigInt)BigInt
    
      def smarandacheBI(n: BigInt = 1): Stream[BigInt] = {
        if (n % 2 == 0 || n % 5 == 0) smarandacheBI(n + 1) else {
          val akt = (for (s <- BigInt(1) to n) yield s.toString()).reduce(_ + _)
          if(akt.map(_.toInt).sum % 3==0) smarandacheBI(n + 1)
          else {
          println(akt)
          Stream.cons(BigInt(akt), smarandacheBI(n + BigInt(1)))
          }
        }
      }                                               //> smarandacheBI: (n: BigInt)Stream[BigInt]
    
      def isPrimeBI(n: BigInt, d: BigInt = BigInt(2)): Boolean = {
        //println(n+" "+d)
        if (n == 1) false
        else if (d >= sqrt(n)) true
        else if (n % d == 0) false
        else isPrimeBI(n, d + 1)
      }                                               //> isPrimeBI: (n: BigInt, d: BigInt)Boolean
    
      smarandacheBI().filter(isPrimeBI(_)).take(1).toList
    
  3. programmingpraxis said

    Actually, I’ve had more fun factoring elements of the Smarandache sequence than searching for primes:

    >>> while True:
    ...     print
    ...     print "Smarandache", i
    ...     print factors(n, 1, 5)
    ...     i = i + 1
    ...     n = n * 10 ** (ilog(10,i)+1) + i
    ...
    
    Smarandache 1
    [1]
    
    Smarandache 2
    Factoring 2-digit number
    Wheel factors with B=1000: 2, 2, 3; remaining cofactor has 1 digits
    [2, 2, 3]
    
    Smarandache 3
    Factoring 3-digit number
    Wheel factors with B=1000: 3, 41; remaining cofactor has 1 digits
    [3, 41]
    
    Smarandache 4
    Factoring 4-digit number
    Wheel factors with B=1000: 2, 617; remaining cofactor has 1 digits
    [2, 617]
    
    Smarandache 5
    Factoring 5-digit number
    Wheel factors with B=1000: 3, 5, 823; remaining cofactor has 1 digits
    [3, 5, 823]
    
    Smarandache 6
    Factoring 6-digit number
    Wheel factors with B=1000: 2, 2, 2, 2, 2, 2, 3, 643; remaining cofactor has 1 digits
    [2, 2, 2, 2, 2, 2, 3, 643]
    
    Smarandache 7
    Factoring 7-digit number
    Wheel factors with B=1000: 127, 9721; remaining cofactor has 1 digits
    [127, 9721]
    
    Smarandache 8
    Factoring 8-digit number
    Wheel factors with B=1000: 2, 3, 3, 47, 14593; remaining cofactor has 1 digits
    [2, 3, 3, 47, 14593]
    
    Smarandache 9
    Factoring 9-digit number
    Wheel factors with B=1000: 3, 3; remaining cofactor has 8 digits
    Rho found 4-digit factor 3607 with B=100000, remaining cofactor has 4 digits
    Remaining 4-digit cofactor 3803 is prime
    [3, 3, 3607L, 3803L]
    
    Smarandache 10
    Factoring 11-digit number
    Wheel factors with B=1000: 2, 5; remaining cofactor has 10 digits
    Remaining 10-digit cofactor 1234567891 is prime
    [2, 5, 1234567891L]
    
    Smarandache 11
    Factoring 13-digit number
    Wheel factors with B=1000: 3, 7, 13, 67, 107, 630803; remaining cofactor has 1 digits
    [3, 7, 13, 67, 107, 630803L]
    
    Smarandache 12
    Factoring 15-digit number
    Wheel factors with B=1000: 2, 2, 2, 3; remaining cofactor has 13 digits
    Rho found 4-digit factor 2437 with B=100000, remaining cofactor has 10 digits
    Remaining 10-digit cofactor 2110805449 is prime
    [2, 2, 2, 3, 2437L, 2110805449L]
    
    Smarandache 13
    Factoring 17-digit number
    Wheel factors with B=1000: 113; remaining cofactor has 15 digits
    Rho found 6-digit factor 125693 with B=100000, remaining cofactor has 9 digits
    Remaining 9-digit cofactor 869211457 is prime
    [113, 125693L, 869211457L]
    
    Smarandache 14
    Factoring 19-digit number
    Wheel factors with B=1000: 2, 3; remaining cofactor has 18 digits
    Remaining 18-digit cofactor 205761315168520219 is prime
    [2, 3, 205761315168520219L]
    
    Smarandache 15
    Factoring 21-digit number
    Wheel factors with B=1000: 3, 5; remaining cofactor has 19 digits
    Remaining 19-digit cofactor 8230452606740808761 is prime
    [3, 5, 8230452606740808761L]
    
    Smarandache 16
    Factoring 23-digit number
    Wheel factors with B=1000: 2, 2; remaining cofactor has 22 digits
    Rho found 10-digit factor 2507191691 with B=100000, remaining cofactor has 13 digits
    Remaining 13-digit cofactor 1231026625769 is prime
    [2, 2, 2507191691L, 1231026625769L]
    
    Smarandache 17
    Factoring 25-digit number
    Wheel factors with B=1000: 3, 3, 47; remaining cofactor has 22 digits
    Rho found 4-digit factor 4993 with B=100000, remaining cofactor has 18 digits
    Remaining 18-digit cofactor 584538396786764503 is prime
    [3, 3, 47, 4993L, 584538396786764503L]
    
    Smarandache 18
    Factoring 27-digit number
    Wheel factors with B=1000: 2, 3, 3, 97; remaining cofactor has 23 digits
    Rho found 5-digit factor 88241 with B=100000, remaining cofactor has 18 digits
    Remaining 18-digit cofactor 801309546900123763 is prime
    [2, 3, 3, 97, 88241L, 801309546900123763L]
    
    Smarandache 19
    Factoring 29-digit number
    Wheel factors with B=1000: 13, 43, 79, 281; remaining cofactor has 21 digits
    Rho found 4-digit factor 1193 with B=100000, remaining cofactor has 18 digits
    Remaining 18-digit cofactor 833929457045867563 is prime
    [13, 43, 79, 281, 1193L, 833929457045867563L]
    
    Smarandache 20
    Factoring 31-digit number
    Wheel factors with B=1000: 2, 2, 2, 2, 2, 3, 5; remaining cofactor has 28 digits
    Rho found 6-digit factor 323339 with B=100000, remaining cofactor has 22 digits
    Rho found 7-digit factor 3347983 with B=100000, remaining cofactor has 16 digits
    Remaining 16-digit cofactor 2375923237887317 is prime
    [2, 2, 2, 2, 2, 3, 5, 323339L, 3347983L, 2375923237887317L]
    
    Smarandache 21
    Factoring 33-digit number
    Wheel factors with B=1000: 3, 17, 37, 43, 103, 131; remaining cofactor has 24 digits
    Rho found 6-digit factor 140453 with B=100000, remaining cofactor has 18 digits
    Remaining 18-digit cofactor 802851238177109689 is prime
    [3, 17, 37, 43, 103, 131, 140453L, 802851238177109689L]
    
    Smarandache 22
    Factoring 35-digit number
    Wheel factors with B=1000: 2, 7; remaining cofactor has 33 digits
    Rho found 4-digit factor 3169 with B=100000, remaining cofactor has 30 digits
    Rho found 4-digit factor 1427 with B=100000, remaining cofactor has 27 digits
    Rho found 5-digit factor 85829 with B=100000, remaining cofactor has 22 digits
    Remaining 22-digit cofactor 2271991367799686681549 is prime
    [2, 7, 1427L, 3169L, 85829L, 2271991367799686681549L]
    
    Smarandache 23
    Factoring 37-digit number
    Wheel factors with B=1000: 3, 41, 769; remaining cofactor has 32 digits
    Remaining 32-digit cofactor 13052194181136110820214375991629 is prime
    [3, 41, 769, 13052194181136110820214375991629L]
    
    Smarandache 24
    Factoring 39-digit number
    Wheel factors with B=1000: 2, 2, 3, 7; remaining cofactor has 37 digits
    ECM found 19-digit factor 1501601205715706321 in Stage 2 of Curve 12 with B1=2000 and B2=200000, remaining cofactor has 18 digits
    Remaining 18-digit cofactor 978770977394515241 is prime
    [2, 2, 3, 7, 978770977394515241L, 1501601205715706321L]
    
    Smarandache 25
    Factoring 41-digit number
    Wheel factors with B=1000: 5, 5; remaining cofactor has 39 digits
    Rho found 5-digit factor 15461 with B=100000, remaining cofactor has 35 digits
    Rho found 11-digit factor 31309647077 with B=100000, remaining cofactor has 25 digits
    Remaining 25-digit cofactor 1020138683879280489689401 is prime
    [5, 5, 15461L, 31309647077L, 1020138683879280489689401L]
    
    Smarandache 26
    Factoring 43-digit number
    Wheel factors with B=1000: 2, 3, 3, 3, 3; remaining cofactor has 40 digits
    Rho found 5-digit factor 21347 with B=100000, remaining cofactor has 36 digits
    Rho found 7-digit factor 2345807 with B=100000, remaining cofactor has 30 digits
    ECM found 12-digit factor 982658598563 in Stage 2 of Curve 1 with B1=2000 and B2=200000, remaining cofactor has 18 digits
    Remaining 18-digit cofactor 154870313069150249 is prime
    [2, 3, 3, 3, 3, 21347L, 2345807L, 982658598563L, 154870313069150249L]
    
    Smarandache 27
    Factoring 45-digit number
    Wheel factors with B=1000: 3, 3, 3, 19, 19; remaining cofactor has 41 digits
    Rho found 4-digit factor 4547 with B=100000, remaining cofactor has 37 digits
    Rho found 5-digit factor 68891 with B=100000, remaining cofactor has 32 digits
    Remaining 32-digit cofactor 40434918154163992944412000742833 is prime
    [3, 3, 3, 19, 19, 4547L, 68891L, 40434918154163992944412000742833L]
    
    Smarandache 28
    Factoring 47-digit number
    Wheel factors with B=1000: 2, 2, 2, 47, 409; remaining cofactor has 41 digits
    ECM found 15-digit factor 416603295903037 in Stage 2 of Curve 2 with B1=2000 and B2=200000, remaining cofactor has 27 digits
    Remaining 27-digit cofactor 192699737522238137890605091 is prime
    [2, 2, 2, 47, 409, 416603295903037L, 192699737522238137890605091L]
    
    Smarandache 29
    Factoring 49-digit number
    Wheel factors with B=1000: 3, 859; remaining cofactor has 45 digits
    ECM found 20-digit factor 24526282862310130729 in Stage 2 of Curve 55 with B1=11000 and B2=1100000, remaining cofactor has 26 digits
    Remaining 26-digit cofactor 19532994432886141889218213 is prime
    [3, 859, 24526282862310130729L, 19532994432886141889218213L]
    
    Smarandache 30
    Factoring 51-digit number
    Wheel factors with B=1000: 2, 3, 5, 13; remaining cofactor has 48 digits
    Rho found 8-digit factor 49269439 with B=100000, remaining cofactor has 40 digits
    ECM found 18-digit factor 370677592383442753 in Stage 2 of Curve 21 with B1=11000 and B2=1100000, remaining cofactor has 23 digits
    Remaining 23-digit cofactor 17333107067824345178861 is prime
    [2, 3, 5, 13, 49269439L, 370677592383442753L, 17333107067824345178861L]
    
    Smarandache 31
    Factoring 53-digit number
    Wheel factors with B=1000: 29; remaining cofactor has 51 digits
    P-1 found 10-digit factor 2597152967 in Stage 2 with B1=2000 and B2=1000000,remaining cofactor has 42 digits
    Remaining 42-digit cofactor 163915283880121143989433769727058554332117 is prime
    [29, 2597152967L, 163915283880121143989433769727058554332117L]
    
    Smarandache 32
    Factoring 55-digit number
    Wheel factors with B=1000: 2, 2, 3, 7; remaining cofactor has 53 digits
    ECM found 23-digit factor 45068391478912519182079 in Stage 2 of Curve 36 with B1=50000 and B2=5000000, remaining cofactor has 30 digits
    Remaining 30-digit cofactor 326109637274901966196516045637 is prime
    [2, 2, 3, 7, 45068391478912519182079L, 326109637274901966196516045637L]
    
    Smarandache 33
    Factoring 57-digit number
    Wheel factors with B=1000: 3, 23, 269; remaining cofactor has 52 digits
    Rho found 4-digit factor 7547 with B=100000, remaining cofactor has 48 digits
    ECM found 18-digit factor 116620853190351161 in Stage 2 of Curve 3 with B1=11000 and B2=1100000, remaining cofactor has 31 digits
    Remaining 31-digit cofactor 7557237004029029700530634132859 is prime
    [3, 23, 269, 7547L, 116620853190351161L, 7557237004029029700530634132859L]
    
    Smarandache 34
    Factoring 59-digit number
    Wheel factors with B=1000: 2; remaining cofactor has 58 digits
    Remaining 58-digit cofactor 6172839455055606570758085909601061116212631364146515661667 is prime
    [2, 6172839455055606570758085909601061116212631364146515661667L]
    
    Smarandache 35
    Factoring 61-digit number
    Wheel factors with B=1000: 3, 3, 5, 139, 151; remaining cofactor has 55 digits
    Rho found 8-digit factor 64279903 with B=100000, remaining cofactor has 47 digits
    ECM found 10-digit factor 4462548227 in Stage 2 of Curve 2 with B1=2000 and B2=200000, remaining cofactor has 37 digits
    Remaining 37-digit cofactor 4556722495899317991381926119681186927 is prime
    [3, 3, 5, 139, 151, 64279903L, 4462548227L, 4556722495899317991381926119681186927L]
    
    Smarandache 36
    Factoring 63-digit number
    Wheel factors with B=1000: 2, 2, 2, 2, 3, 3, 103, 211; remaining cofactor has 56 digits
    Remaining 56-digit cofactor 39448709943503776711542648338171477043440283875433388943 is prime
    [2, 2, 2, 2, 3, 3, 103, 211, 39448709943503776711542648338171477043440283875433388943L]
    
    Smarandache 37
    Factoring 65-digit number
    Wheel factors with B=1000: 71; remaining cofactor has 63 digits
    Rho found 5-digit factor 12379 with B=100000, remaining cofactor has 59 digits
    Rho found 7-digit factor 4616929 with B=100000, remaining cofactor has 52 digits
    Remaining 52-digit cofactor 3042410911077206144807069396988766146557218727107817 is prime
    [71, 12379L, 4616929L, 3042410911077206144807069396988766146557218727107817L]
    
    Smarandache 38
    Factoring 67-digit number
    Wheel factors with B=1000: 2, 3; remaining cofactor has 66 digits
    ECM found 23-digit factor 86893956354189878775643 in Stage 2 of Curve 67 with B1=50000 and B2=5000000, remaining cofactor has 43 digits
    Remaining 43-digit cofactor 2367958875411463048104007458352976869124861 is prime
    [2, 3, 86893956354189878775643L, 2367958875411463048104007458352976869124861L]
    
    Smarandache 39
    Factoring 69-digit number
    Wheel factors with B=1000: 3, 67, 311; remaining cofactor has 64 digits
    Rho found 4-digit factor 1039 with B=100000, remaining cofactor has 61 digits
    ECM found 25-digit factor 6216157781332031799688469 in Stage 2 of Curve 126 with B1=50000 and B2=5000000, remaining cofactor has 36 digits
    Remaining 36-digit cofactor 305788363093026251381516836994235539 is prime
    [3, 67, 311, 1039L, 6216157781332031799688469L, 305788363093026251381516836994235539L]
    
    Smarandache 40
    Factoring 71-digit number
    Wheel factors with B=1000: 2, 2, 5; remaining cofactor has 69 digits
    Rho found 4-digit factor 3169 with B=100000, remaining cofactor has 66 digits
    Rho found 5-digit factor 60757 with B=100000, remaining cofactor has 61 digits
    Rho found 6-digit factor 579779 with B=100000, remaining cofactor has 55 digits
    P-1 found 10-digit factor 4362289433 in Stage 1 with B1=2000 and B2=1000000,remaining cofactor has 46 digits
    ECM found 20-digit factor 79501124416220680469 in Stage 2 of Curve 48 with B1=50000 and B2=5000000, remaining cofactor has 26 digits
    Remaining 26-digit cofactor 15944694111943672435829023 is prime
    [2, 2, 5, 3169L, 60757L, 579779L, 4362289433L, 79501124416220680469L, 15944694111943672435829023L]
    
    Smarandache 41
    Factoring 73-digit number
    Wheel factors with B=1000: 3, 487; remaining cofactor has 69 digits
    Rho found 8-digit factor 32002651 with B=100000, remaining cofactor has 62 digits
    Rho found 6-digit factor 493127 with B=100000, remaining cofactor has 56 digits
    Remaining 56-digit cofactor 53545135784961981058419604998638516483529257158438201753 is prime
    [3, 487, 493127L, 32002651L, 53545135784961981058419604998638516483529257158438201753L]
    
    Smarandache 42
    Factoring 75-digit number
    Wheel factors with B=1000: 2, 3, 127, 421; remaining cofactor has 69 digits
    P-1 found 11-digit factor 22555732187 in Stage 2 with B1=2000 and B2=1000000,remaining cofactor has 59 digits
    P-1 found 25-digit factor 4562371492227327125110177 in Stage 2 with B1=50000, B2=25000000, and X=2, remaining cofactor has 34 digits
    Remaining 34-digit cofactor 3739644646350764691998599898592229 is prime
    [2, 3, 127, 421, 22555732187L, 4562371492227327125110177L, 3739644646350764691998599898592229L]
    
    Smarandache 43
    Factoring 77-digit number
    Wheel factors with B=1000: 7, 17, 449; remaining cofactor has 72 digits
    Remaining 72-digit cofactor 231058353953907153927797941629430896528705484237484443924582239474910453 is prime
    [7, 17, 449, 231058353953907153927797941629430896528705484237484443924582239474910453L]
    
    Smarandache 44
    Factoring 79-digit number
    Wheel factors with B=1000: 2, 2, 2, 3, 3; remaining cofactor has 77 digits
    Abandoning factorization with 77-digit composite cofactor
    [0, 2, 2, 2, 3, 3, 17146776264043351585439127526669614211701753789295876837964380051922139464227L]
    
    Smarandache 45
    Factoring 81-digit number
    Wheel factors with B=1000: 3, 3, 5, 7, 41, 727; remaining cofactor has 74 digits
    Rho found 4-digit factor 1291 with B=100000, remaining cofactor has 71 digits
    ECM found 13-digit factor 2634831682519 in Stage 2 of Curve 1 with B1=2000 and B2=200000, remaining cofactor has 58 digits
    ECM found 18-digit factor 379655178169650473 in Stage 2 of Curve 16 with B1=11000 and B2=1100000, remaining cofactor has 41 digits
    Remaining 41-digit cofactor 10181639342830457495311038751840866580037 is prime
    [3, 3, 5, 7, 41, 727, 1291L, 2634831682519L, 379655178169650473L, 10181639342830457495311038751840866580037L]
    
    Smarandache 46
    Factoring 83-digit number
    Wheel factors with B=1000: 2, 31, 103; remaining cofactor has 79 digits
    Rho found 9-digit factor 270408101 with B=100000, remaining cofactor has 70 digits
    P-1 found 18-digit factor 374332796208406291 in Stage 2 with B1=2000 and B2=1000000,remaining cofactor has 53 digits
    ECM found 25-digit factor 3890951821355123413169209 in Stage 2 of Curve 58 with B1=11000 and B2=1100000, remaining cofactor has 28 digits
    Remaining 28-digit cofactor 4908543378923330485082351119 is prime
    [2, 31, 103, 270408101L, 374332796208406291L, 3890951821355123413169209L, 4908543378923330485082351119L]
    
    Smarandache 47
    Factoring 85-digit number
    Wheel factors with B=1000: 3; remaining cofactor has 84 digits
    Rho found 4-digit factor 4813 with B=100000, remaining cofactor has 80 digits
    Rho found 6-digit factor 679751 with B=100000, remaining cofactor has 75 digits
    ECM found 22-digit factor 4626659581180187993501 in Stage 2 of Curve 7 with B1=50000 and B2=5000000, remaining cofactor has 53 digits
    Remaining 53-digit cofactor 27186948196033729596487563460186407241534572026740723 is prime
    [3, 4813L, 679751L, 4626659581180187993501L, 27186948196033729596487563460186407241534572026740723L]
    
    Smarandache 48
    Factoring 87-digit number
    Wheel factors with B=1000: 2, 2, 3, 179; remaining cofactor has 83 digits
    Rho found 4-digit factor 1493 with B=100000, remaining cofactor has 80 digits
    Rho found 7-digit factor 1894439 with B=100000, remaining cofactor has 74 digits
    Abandoning factorization with 74-digit composite cofactor
    [0, 2, 2, 3, 179, 1493L, 1894439L, 20320774991535152388175335880426877282982584987974617900489904484536181713L]
    
    Smarandache 49
    Factoring 89-digit number
    Wheel factors with B=1000: 23, 109; remaining cofactor has 85 digits
    Rho found 7-digit factor 3251653 with B=100000, remaining cofactor has 79 digits
    Rho found 10-digit factor 2191196713 with B=100000, remaining cofactor has 69 digits
    ECM found 23-digit factor 53481597817014258108937 in Stage 2 of Curve 294 with B1=50000 and B2=5000000, remaining cofactor has 47 digits
    Remaining 47-digit cofactor 12923219128084505550382930974691083231834648599 is prime
    [23, 109, 3251653L, 2191196713L, 53481597817014258108937L, 12923219128084505550382930974691083231834648599L]
    
    Smarandache 50
    Factoring 91-digit number
    Wheel factors with B=1000: 2, 3, 5, 5, 13, 211; remaining cofactor has 85 digits
    Rho found 5-digit factor 20479 with B=100000, remaining cofactor has 81 digits
    ECM found 18-digit factor 160189818494829241 in Stage 2 of Curve 10 with B1=11000 and B2=1100000, remaining cofactor has 63 digits
    ECM found 20-digit factor 46218039785302111919 in Stage 2 of Curve 66 with B1=11000 and B2=1100000, remaining cofactor has 44 digits
    Remaining 44-digit cofactor 19789860528346995527543912534464764790909391 is prime
    [2, 3, 5, 5, 13, 211, 20479L, 160189818494829241L, 46218039785302111919L, 19789860528346995527543912534464764790909391L]
    
    Smarandache 51
    Factoring 93-digit number
    Wheel factors with B=1000: 3; remaining cofactor has 92 digits
    ECM found 20-digit factor 17708093685609923339 in Stage 2 of Curve 17 with B1=11000 and B2=1100000, remaining cofactor has 73 digits
    Remaining 73-digit cofactor 2323923950500978408934946776574079545611397611995364705071565292612305003 is prime
    [3, 17708093685609923339L, 2323923950500978408934946776574079545611397611995364705071565292612305003L]
    
    Smarandache 52
    Factoring 95-digit number
    Wheel factors with B=1000: 2, 2, 2, 2, 2, 2, 2; remaining cofactor has 92 digits
    ECM found 17-digit factor 43090793230759613 in Stage 2 of Curve 7 with B1=11000 and B2=1100000, remaining cofactor has 76 digits
    Remaining 76-digit cofactor 2238311464092386636761884511894978048448617178182150344531477542781856216843 is prime
    [2, 2, 2, 2, 2, 2, 2, 43090793230759613L, 2238311464092386636761884511894978048448617178182150344531477542781856216843L]
    
    Smarandache 53
    Factoring 97-digit number
    Wheel factors with B=1000: 3, 3, 3, 7, 7, 7; remaining cofactor has 93 digits
    ECM found 18-digit factor 127534541853151177 in Stage 2 of Curve 26 with B1=11000 and B2=1100000, remaining cofactor has 76 digits
    Remaining 76-digit cofactor 1045271879581348729278017817925065799872257805888381045072615907010178634849 is prime
    [3, 3, 3, 7, 7, 7, 127534541853151177L, 1045271879581348729278017817925065799872257805888381045072615907010178634849L]
    
    Smarandache 54
    Factoring 99-digit number
    Wheel factors with B=1000: 2, 3, 3, 3, 3, 3, 3, 79, 389; remaining cofactor has 91 digits
    Rho found 4-digit factor 3167 with B=100000, remaining cofactor has 87 digits
    Rho found 5-digit factor 13309 with B=100000, remaining cofactor has 83 digits
    ECM found 11-digit factor 69526661707 in Stage 2 of Curve 3 with B1=2000 and B2=200000, remaining cofactor has 72 digits
    ECM found 22-digit factor 8786705495566261913717 in Stage 2 of Curve 32 with B1=50000 and B2=5000000, remaining cofactor has 51 digits
    Remaining 51-digit cofactor 107006417566370797549761092803112128112769421435739 is prime
    [2, 3, 3, 3, 3, 3, 3, 79, 389, 3167L, 13309L, 69526661707L, 8786705495566261913717L, 107006417566370797549761092803112128112769421435739L]
  4. fisherro said

    Funny that these days I think of writing a generator function first. I could’ve just included that logic in the loop. I blame all the playing around with ranges (i.e. lazy sequences) that I’ve been doing.

    I reused the isprime function (not shown) that I’d written for an earlier collatz primes exercise.

    #include <sstream>
    #include <string>
    #include <algorithm>
    #include <iterator>
    #include <iostream>
    #include <boost/multiprecision/cpp_int.hpp>
    #include "isprime.hpp"
    
    using Int = boost::multiprecision::cpp_int;
    
    auto triangle = [current = Int(1), oss = std::ostringstream()]() mutable {
        oss << current++;
        return Int(oss.str());
    };
    
    int main()
    {
        while (true) {
            Int candidate = triangle();
            bool prime = isprime(candidate);
            std::cout << candidate << ": " << prime << '\n';
            if (prime) break;
        }
    }
    

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: