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-2 of 2 results.

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

Original entry on oeis.org

2, 5, 11, 17, 19, 23, 47, 67, 71, 79, 131, 191, 257, 263, 271, 383, 1031, 1039, 1087, 1151, 1279, 2063, 2111, 4099, 4111, 4127, 4159, 5119, 6143, 8447, 16447, 20479, 32771, 32783, 32831, 33023, 33791, 65537, 65539, 65543, 65551, 65599, 66047, 73727, 81919, 262147, 262151, 262271, 262399, 263167
Offset: 1

Views

Author

Hieronymus Fischer, Mar 28 2014 and Apr 22 2014

Keywords

Comments

Numbers m such that b = 2 is the only base such that the base-b digital sum of m + 1 is equal to b.
Example: 5 + 1 = 110_2 which implies ds_2(5 + 1) = 2 = b, where ds_b = digital sum in base-b. However, ds_3(6) = 2 <> 3, ds_4(6) = 3 <> 4, ds_5(6) = 2 <> 5, ds_6(6) = 1 <> 6. For all other bases > 6 we have ds_b(6) = 6 <> b. It follows that b = 2 is the only such base.
The base-2 representation of a term 2^i + 2^j - 1 has a base-2 digital sum of 1 + j.
In base-2 representation the first terms are 10, 101, 1011, 10001, 10011, 10111, 101111, 1000011, 1000111, 1001111, 10000011, 10111111, 100000001, 100000111, 100001111, 101111111, 10000000111, 10000001111, 10000111111, 10001111111, ...
Numbers m = 2^i + 2^j - 1 with odd i and j are not terms. Example: 10239 = 2^13 + 2^11 - 1 is not a prime.

Examples

			a(1) = 2, since 2 = 2^1 + 2^0 - 1 is prime.
a(5) = 19, since 19 = 2^4 + 2^2 - 1 is prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Union[Total/@(2^#&/@Subsets[Range[0,20],{2}])-1],PrimeQ] (* Harvey P. Dale, Aug 08 2014 *)
  • Smalltalk
    A239712
    "Answers the n-th term of A239712.
      Usage: n A239712
      Answer: a(n)"
      | a b i k m p q terms |
      terms := OrderedCollection new.
      b := 2.
      p := 1.
      k := 0.
      m := 0.
      [k < self] whileTrue:
             [m := m + 1.
             p := b * p.
             q := 1.
             i := 0.
             [i < m and: [k < self]] whileTrue:
                       [i := i + 1.
                       a := p + q - 1.
                       a isPrime
                            ifTrue:
                                [k := k + 1.
                                terms add: a].
                       q := b * q]].
      ^terms at: self
    [by Hieronymus Fischer, Apr 22 2014]
    -----------
    
  • Smalltalk
    floorPrimesWhichAreDistinctPowersOf: b withOffset: d
      "Answers an array which holds the primes < n that obey b^i + b^j + d, i>j>=0,
      where n is the receiver. b > 1 (here: b = 2, d = -1).
      Uses floorDistinctPowersOf: from A018900
      Usage:
      n floorPrimesWhichAreDistinctPowersOf: b withOffset: d
      Answer: #(2 5 11 17 19 23 ...) [terms < n]"
      ^((self - d floorDistinctPowersOf: b)
      collect: [:i | i + d]) select: [:i | i isPrime]
    [by Hieronymus Fischer, Apr 22 2014]
    ------------
    
  • Smalltalk
    primesWhichAreDistinctPowersOf: b withOffset: d
      "Answers an array which holds the n primes of the form b^i + b^j + d, i>j>=0, where n is the receiver.
      Direct calculation by scanning b^i + b^j + d in increasing order and selecting terms which are prime.
      b > 1; this sequence: b = 2, d = 1.
      Usage:
      n primesWhichAreDistinctPowersOf: b withOffset: d
      Answer: #(2 5 11 17 19 23 ...) [a(1) ... a(n)]"
      | a k p q terms n |
      terms := OrderedCollection new.
      n := self.
      k := 0.
      p := b.
      [k < n] whileTrue:
             [q := 1.
             [q < p and: [k < n]] whileTrue:
                       [a := p + q + d.
                       a isPrime
                            ifTrue:
                                [k := k + 1.
                                terms add: a].
                       q := b * q].
             p := b * p].
      ^terms asArray
    [by Hieronymus Fischer, Apr 22 2014]

Formula

a(n) = A239708(n) - 1.
a(n+1) = min(A018900(k) > a(n)| A018900(k) - 1 is prime, k >= 1) - 1.

Extensions

Examples moved from Maple field to Examples field by Harvey P. Dale, Aug 08 2014

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

Original entry on oeis.org

71, 4159, 32831, 262151, 266239, 294911, 2101247, 18874367, 134479871, 1073741831, 68721573887, 549755813951, 4398046515199, 4398046543871, 4398046773247, 4398063288319, 281474976711167, 281474976743423, 281474978807807, 281474993487871, 282024732524543
Offset: 1

Views

Author

Hieronymus Fischer, Apr 14 2014

Keywords

Comments

The base-8 representation of a term 8^i + 8^j - 1 has base-8 digital sum = 1 + 7*j == 1 (mod 7).
In base-8 representation the first terms are 107, 10077, 100077, 1000007, 1007777, 1077777, 10007777, 107777777, 1000777777, 10000000007, 1000007777777, 10000000000077, 100000000007777, ...
Numbers m that satisfy m = 8^i + 8^j - 1 with odd i and j are not terms. Example: 33279 = 8^5 + 8^3 - 1 = 3*11093.

Examples

			a(1) = 71, since 71 = 8^2 + 8^1 - 1 is prime.
a(2) = 4159, since 4159 = 8^4 + 8^2 - 1 is prime.
		

Crossrefs

Cf. A018900, A239709, A239712 (base 2), A239713 (base 3), A239714 (base 4), A239715 (base 5), A239716 (base 6), A239717 (base 7), A239719 (base 9), A239720 (base 10).

Programs

  • Maple
    select(isprime, [seq(seq(8^i+8^j-1, j=0..i-1), i=1..25)])[];  # Alois P. Heinz, Dec 22 2024
  • Smalltalk
    A239718
      "Answers an array of the first n terms of A239718.
      Uses method primesWhichAreDistinctPowersOf: b withOffset: d from A239712.
    Usage: n A239718
    Answer: #(71 4159 ... ) [a(1) ... a(n)]"
      ^self primesWhichAreDistinctPowersOf: 8 withOffset: -1
Showing 1-2 of 2 results.