OFFSET
1,1
COMMENTS
LINKS
Hieronymus Fischer, Table of n, a(n) for n = 1..250
FORMULA
A239703(a(n)) = 1.
EXAMPLE
a(1) = 3, since 3 = 2^1 + 2^0.
a(3) = 12, since 12 = 2^3 + 2^2.
PROG
(Smalltalk)
"Answers the n-th term of A239708.
Usage: n A239708
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.
(a - 1) isPrime
ifTrue:
[k := k + 1.
terms add: a].
q := b * q]].
^terms at: self
-----------------
(Smalltalk)
A239708inv
"Answers a kind of inverse of A239708.
Usage: n A239708inv
Answer: max ( k | A239708(k) < n)"
| k |
k := 1.
[k A239708 < self] whileTrue: [k := k + 1].
^k - 1
CROSSREFS
KEYWORD
nonn
AUTHOR
Hieronymus Fischer, Mar 27 2014
STATUS
approved