OFFSET
1,1
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.
LINKS
Hieronymus Fischer, Table of n, a(n) for n = 1..10000
FORMULA
a(n) < n^2 for n > 4.
lim a(n)/n^2 = 1, for n --> infinity.
EXAMPLE
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.
PROG
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Hieronymus Fischer, May 04 2014
STATUS
approved