A239712 Primes of the form m = 2^i + 2^j - 1, where i > j >= 0.
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
Keywords
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.
Links
- Hieronymus Fischer, Table of n, a(n) for n = 1..250
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
Extensions
Examples moved from Maple field to Examples field by Harvey P. Dale, Aug 08 2014
Comments