cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A239709 Primes of the form m = b^i + b^j - 1, where i > j > 0, b > 1.

Original entry on oeis.org

5, 11, 17, 19, 23, 29, 41, 47, 67, 71, 79, 83, 89, 107, 109, 131, 149, 181, 191, 239, 251, 257, 263, 269, 271, 349, 379, 383, 419, 461, 599, 701, 809, 811, 929, 971, 991, 1009, 1031, 1039, 1087, 1151, 1259, 1279, 1301, 1451, 1481, 1511, 1559, 1721, 1871, 1979, 2063, 2069, 2111, 2161, 2213, 2267, 2351, 2549, 2861, 2939, 2969, 3079, 3191, 3389
Offset: 1

Views

Author

Hieronymus Fischer, Mar 27 2014

Keywords

Comments

If m is a term, then there is a base b > 1 such that the base-b representation of m has digital sum = 1 + j*(b-1) == 1 (mod (b-1)).
The base b for which m = b^i + b^j - 1 is not uniquely determined. Example: 11 = 2^3+2^2-1 = 3^2 +3^1-1.
Numbers m which satisfy m = b^i + b^j - 1 with odd i and j and b == 2 (mod 3) are not terms. Example: 12189 = 23^3 + 23^1 - 1 is not a prime.

Examples

			a(1) = 5, since 5 = 2^2 + 2^1 - 1 is prime.
a(2) = 11, since 11 = 2^3 + 2^2 - 1 is prime.
a(6) = 29, since 29 = 3^3 + 3^1 - 1 is prime.
a(10^1) = 71.
a(10^2) = 13109.
a(10^3) = 9336079.
a(10^4) = 2569932329.
a(10^5) = 455578426189.
a(10^6) = 68543190483641.
		

Crossrefs

Programs

  • Smalltalk
    A239709
    "Answers the n-th term of A239709.
      Iterative calculation using A239709_termsLTn.
      Usage: n A239709
      Answer: a(n)"
      | n terms m |
      terms := SortedCollection new.
      n := self.
      m := (n prime // 2) squared.
      terms := m A239709_termsLTn.
      [terms size < n] whileTrue:
             [m := 2 * m.
             terms := m A239709_termsLTn].
      ^terms at: n
      "Remark: A last line of
      ^terms copyFrom: 1 to: n
      answers an array of the first n terms"
    [by_Hieronymus Fischer_, Apr 14 2014]
    -----------
    
  • Smalltalk
    A239709_termsLTn
      "Answers all the terms of A239709 which are < n.
      Direct processing by scanning the scanning the bases b in increasing order, up to b = sqrt(n), and calculating the numbers b^i + b^j - 1.
      Usage: n A239709_termsLTn
      Answer: #(5 11 17 19 23 ...) [terms < n]"
      | bmax p q n m terms a |
      terms := OrderedCollection new.
      n := self.
      bmax := n sqrtTruncated.
      2 to: bmax
         do:
             [:b |
             m := 1 + (n floorLog: b).
             p := b.
             2 to: m
                  by: 1
                  do:
                       [:i |
                       p := b * p.
                       q := b.
                       1 to: i - 1
                            by: 1
                            do:
                                [:j |
                                a := p + q - 1.
                                a < n ifTrue: [a isPrime ifTrue: [terms add: a]].
                                q := b * q]]].
      ^terms asSet asArray sorted
    [by_Hieronymus Fischer_, Apr 14 2014]
    -----------
    
  • Smalltalk
    A239709nTerms
      "Alternative version: Answers the first n terms of A239709. Direct calculation by scanning the numbers b^i + b^j - 1 in increasing order.
      Usage: n A239709
      Answer: a(n)"
      | a amax an b bmax k terms p q p_i q_j a_b amin bamin |
      terms := SortedCollection new.
      p_i := OrderedCollection new.
      q_j := OrderedCollection new.
      a_b := OrderedCollection new.
      p_i add: 1.
      q_j add: 1.
      a_b add: 1.
      k := 0.
      b := 2.
      bmax := b.
      p := b * b.
      q := b.
      a := p + q - 1.
      p_i add: p.
      q_j add: q.
      a_b add: a.
      amax := 2 * (b + 1) + a.
      an := 0.
      [(k < self and: [a < amax]) or: [a < an]] whileTrue:
             [[(k < self and: [a < amax]) or: [a < an]] whileTrue:
                       [[q < p and: [(k < self and: [a < amax]) or: [a < an]]] whileTrue:
                                [a isPrime2
                                     ifTrue:
                                          [(terms includes: a)
                                              ifFalse:
                                                   [k := k + 1.
                                                   terms add: a.
                                                   k >= self ifTrue: [an := terms at: self]]].
                                q := b * q.
                                a := p + q - 1].
                       p = q
                            ifTrue:
                                [p := b * p.
                                q := b.
                                a := p + q - 1].
                       p_i at: b put: p.
                       q_j at: b put: q.
                       a_b at: b put: a].
             amin := a.
             2 to: b - 1
                  do:
                       [:bb |
                       (a_b at: bb) < amin
                            ifTrue:
                                [amin := a_b at: bb.
                                bamin := bb]].
             b + 1 to: bmax
                  do:
                       [:bb |
                       (a_b at: bb) < amin
                            ifTrue:
                                [amin := a_b at: bb.
                                bamin := bb]].
             amin < (a min: amax)
                  ifTrue:
                       [b := bamin.
                       p := p_i at: b.
                       q := q_j at: b.
                       a := a_b at: b]
                  ifFalse:
                       [bmax := bmax + 1.
                       b := bmax.
                       p := b * b.
                       q := b.
                       a := p + q - 1.
                       p_i add: p.
                       q_j add: q.
                       a_b add: a.
                       amax := 2 * (b + 1) + a max: amax]].
      ^terms copyFrom: 1 to: self
    [by_Hieronymus Fischer_, Apr 20 2014]

A239711 Twin primes of the form m = b^i + b^j +- 1, where i > j > 0, b > 1.

Original entry on oeis.org

5, 7, 11, 13, 17, 19, 29, 31, 41, 43, 71, 73, 107, 109, 149, 151, 191, 193, 239, 241, 269, 271, 419, 421, 461, 463, 599, 601, 809, 811, 1031, 1033, 1151, 1153, 1301, 1303, 1451, 1453, 1481, 1483, 1721, 1723, 1871, 1873, 2111, 2113, 2267, 2269, 2549, 2551, 2969, 2971, 3389, 3391, 3539, 3541
Offset: 1

Views

Author

Hieronymus Fischer, Mar 27 2014 and May 04 2014

Keywords

Comments

(a(2k-1), a(2k)), k > 0, form pairs of twin primes.
Numbers m that satisfy m = b^i + b^j + 1 and b == 1 (mod 3) and those that satisfy m = b^i + b^j - 1 with odd i and j and b == 2 (mod 3) are never terms, since they are divisible by 3. It follows that no numbers 4^i + 4^j +- 1, or 7^i + 7^j +- 1, or 10^i + 10^j +- 1, ... can be terms. Also, no numbers 5^(2m-1) + 5^(2k-1) +- 1, or 8^(2m-1) + 8^(2k-1) +- 1, or 11^(2m-1) + 11^(2k-1) +- 1, ... with m > k > 0, can be terms.
Example 1: 10^6 + 10^4 + 1 = 1010001 is not a term, since 10 == 1 (mod 3); certainly, 1010001 = 3*336667.
Example 2: 8^9 + 8^7 - 1 = 136314879 is not a term, since 8 == 2 (mod 3) and i, j odd; certainly 136314879 = 3*45438293.

Examples

			a(1) = 5, since 5 = 2^2 + 2^1 - 1 is prime.
a(2) = 7, since 7 = 2^3 + 2^1 + 1 is prime.
a(7) = 29, since 29 = 3^3 + 3^1 - 1 is prime.
a(8) = 31, since 31 = 3^3 + 3^1 + 1 is prime.
a(9) = 41.
a(10) = 43.
a(99) = 43889.
a(100) = 43891.
a(999) = 233524241.
a(1000) = 233524243.
a(9999) = 110211052379.
a(10000) = 110211052381.
a(99999) = 27208914574871.
a(100000) = 27208914574873.
a(199999) = 136140088764371.
a(200000) = 136140088764373.
[the last two terms form the 100000th twin prime pair of the form b^i + b^j +-1]
		

Crossrefs

A242100 Numbers of the form m = b^i + b^j, where b > 1 and i > j > 0.

Original entry on oeis.org

6, 10, 12, 18, 20, 24, 30, 34, 36, 40, 42, 48, 56, 66, 68, 72, 80, 84, 90, 96, 108, 110, 130, 132, 136, 144, 150, 156, 160, 182, 192, 210, 222, 240, 246, 252, 258, 260, 264, 270, 272, 288, 306, 320, 324, 342, 350, 380, 384, 392, 420, 462, 506, 514, 516, 520
Offset: 1

Views

Author

Hieronymus Fischer, May 04 2014

Keywords

Comments

If m is a term, then there is a base b > 1 such that the base-b representation of m has digital sum = 2.
The base b for which m = b^i + b^j is not uniquely determined. Example: 12 = 2^3+2^2 = 3^2 +3^1.

Examples

			a(1)    = 6, since 2 = 2^2 + 2^1.
a(7)    = 30, since 30 = 3^3 + 3^1.
a(10)   = 40.
a(10^2) = 1722.
a(10^3) = 377610.
a(10^4) = 70635620.
a(10^5) = 8830078992.
a(10^6) = 951958292172.
a(10^7) = 97932587392010.
a(10^8) = 9908034917287656.
a(10^9) = 995834160614903742.
		

Crossrefs

Programs

  • Smalltalk
    distinctPowersWithOffset: d
      "Answers an array which holds the first n numbers of the form b^i + b^j + d, i>j>0, where b is any natural number > 1, d is any integer number, and n is the receiver (d=0 for this sequence).
      Usage: n distinctPowersWithOffset: 0
      Answer: #(6 10 12 ...) [first n terms]"
      | n terms m |
      terms := SortedCollection new.
      n := self.
      m := n squared max: 20.
      terms := m floorDistinctPowersWithOffset: d.
      ^terms copyFrom: 1 to: n
    ----------
    floorDistinctPowersWithOffset: d
      "Answers an array which holds the numbers < n of the form b^i + b^j + d, i>j>0, where b is any natural number > 1, d is any integer number, and n is the receiver (d=0 for this sequence).
      Usage: n floorDistinctPowersWithOffset: 0
      Answer: #(6 10 12 18 ...) [all terms < n]"
      | bmax p q n m terms a |
      terms := OrderedCollection new.
      n := self.
      bmax := ((4 * (n - d) + 1) sqrtTruncated - 1) // 2.
      2 to: bmax
        do:
             [:b |
             p := b * b.
             q := b.
             a := p + q + d.
             [a < n] whileTrue:
                       [[q < p and: [a < n]] whileTrue:
                                [terms add: a.
                                q := b * q.
                                a := p + q + d].
                       p := b * p.
                       q := b.
                       a := p + q + d]].
      ^terms asSet asOrderedCollection sorted

Formula

a(n) < n^2 for n > 4.
lim a(n)/n^2 = 1, for n --> infinity.
Showing 1-3 of 3 results.