

A187813


Numbers n whose baseb digit sum is not b for all bases b >= 2.


19



0, 1, 2, 4, 8, 14, 30, 32, 38, 42, 44, 54, 60, 62, 74, 84, 90, 98, 102, 104, 108, 110, 114, 128, 138, 140, 150, 152, 158, 164, 168, 174, 180, 182, 194, 198, 200, 212, 224, 228, 230, 234, 240, 242, 252, 270, 278, 282, 284, 294, 308, 312, 314, 318, 332, 338, 348
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

Except for 1, every number is even.
No number ends in 6.
A079696 and this sequence have no terms in common.
Numbers which satisfy m == 1 (mod j) and m > j^2 for any j > 1 are not terms.
Example 1: m = 10^k, k>1, is not a term since 10^k == 1 (mod 9) and 10^k > 9^2.
Example 2: m = 1 + 3k, k > 3, is not a term, since m > 3(1+3) > 3^2.
Disregarding the first 3 terms, these are the numbers which are in A008864 but not in A239708. This leads to the following characterization: A number m > 2 is a term, i.e., satisfies digitalSum_b(m) <> b for all b > 1, if and only m is a prime number + 1 and m is not the sum of two distinct powers of 2.
a(6) is the only term such that a(n) = Prime(n) + 1. For n < 6, we have a(n) < Prime(n) + 1, and for n > 6, we have a(n) > Prime(n) + 1.
(End)


LINKS



FORMULA

a(n+1) = min (p > a(n)  A239703(p) = 0)
[for a Smalltalk implementation see Prog section, method A187813NextTerm version 1].
a(n+1) = 1 + min (p > a(n)  p is prime AND ((q := p+1  2^floor(log_2(p+1)) = 0) OR (2^floor(log_2(q)) <> q)))
[for a Smalltalk implementation see Prog section, method A187813NextTerm version 2].
a(n) > Prime(n), for n > 5.
a(n  m) < Prime(n), for n > 1, where m := i*(i1)/2 + j  1, i := floor(log_2(Prime(n))), j := floor(log_2(Prime(n)  2^i)).
a(n  m) < Prime(n), for n > 32, where m := i*(i1)/2 + j  16 with i and j above.
a(n) = Prime(n + m  3) + 1, where m = max ( k  A239708(k) < a(n)), n > 3.
Remark: This identity can be used to calculate a(n) recursively. For a Smalltalk implementation see Prog section, methods A187813rec and A187813With: estimate.
With same conditions: a(n) = A008864(n + m  3).
a(n  m + 3) = Prime(n) + 1, where m = max ( k  A239708(k) < Prime(n)), n > 3, provided Prime(n) + 1 is not a term of A239708.
(End)


EXAMPLE

8 has binary expansion (1,0,0,0) whose digit sum 1 is not 2,
ternary expansion (2,2) whose digit sum 4 is not 3,
quaternary expansion (2,0) whose digit sum 2 is not 4,
5ary expansion (1,3) whose digit sum 4 is not 5,
6ary expansion (1,2) whose digit sum 3 is not 6,
7ary expansion (1,1) whose digit sum 2 is not 7,
8ary expansion (1,0) whose digit sum 1 is not 8,
and bary expansion (8) when b>8 whose digit sum is 8 not b. Therefore, 8 is in the sequence.
3 has binary expansion (1,1) whose digit sum is 2, so 3 is not in the sequence.
a(10) = 42 (the 13th prime + 1)
a(100) = 618 (the 113th prime + 1)
a(1000) = 8172 (the 1026th prime + 1)
a(10^4) = 105254 (the 10042nd prime + 1)
a(10^5) = 1300464 (the 100056th prime + 1)
a(10^6) = 15486872 (the 1000063th prime + 1)
a(10^7) = 179425944 (the 10000071st prime + 1)
a(10^8) = 2038076324 (the 10^8 +84th prime + 1)
a(10^9) = 22801765334 (the 10^9 +92nd prime + 1)
a(10^10) = 252097803264 (the 10^10 +102nd prime + 1)
[calculation for large numbers processed with Smalltalk method A187813With: estimate; see Prog section]
(End)


MATHEMATICA

Q@n_:=AllTrue[Table[{b, Plus@@IntegerDigits[n, b]}, {b, 2, n}], #[[1]]!=#[[2]]&];


PROG

(Sage)
n=1000 #change n for more terms
S=[]
for i in [0..n]:
test=False
for b in [2..i]:
if sum(Integer(i).digits(base=b))==b:
test=True
break
if not test:
S.append(i)
S
(Smalltalk)
A187813NextTerm
"Calculates the next term of A187813 greater than the receiver, i.e., calculates a(n+1) from a(n).
Usage: a(n) A187813NextTerm
Answer: a(n+1)
Version 1: Using numOfBasesWithDigitalSumEQBase from A239703 ==> fast calculation, since only the divisors of <an> have to tested to be candidates for bases b with baseb digital sum equal to b"
 an 
an := self + 1.
[an numOfBasesWithDigitalSumEQBase > 0]
whileTrue: [an := an+1].
^an

A187813NextTerm
"Calculates the next term of A187813 greater than the receiver, i.e., calculates a(n+1) from a(n).
Usage: a(n) A187813NextTerm
Answer: a(n+1)
Version 2: Using the equivalence with A008864 and A239708 ==> even much more faster calculation"
 p q 
self < 0 ifTrue: [^0].
self = 0 ifTrue: [^1].
self = 1 ifTrue: [^2].
p := (self  1) nextPrime.
q := p+1(2 raisedToInteger: (p+1 integerFloorLog: 2)).
[q > 0 and: [(2 raisedToInteger: (q integerFloorLog: 2))  q = 0]] whileTrue: [p := p nextPrime.
q := p + 1  (2 raisedToInteger: (p + 1 integerFloorLog: 2))].
^p + 1

"Calculates the nth term of A187813, iteratively.
Answer: a(n)"
 an n 
n := self.
n < 3 ifTrue: [^#(0 1) at: n].
an := 2.
4 to: n do: [:i an := an A187813NextTerm].
^an

A187813rec
"Calculates the nth term of A187813, using the recursive method <A187813With: param>
Answer: a(n)"
self < 3 ifTrue: [^#(0 1) at: self].
^self A187813With: self prime

A187813With: estimate
"Method to calculate the nth term of A187813 based on the value estimate, recursively. The nth prime is a adequate estimate. Valid for n > 2.
Usage: n A187813With: estimate
Answer: a(n)"
 x m 
(x:=((m:= estimate A239708inv)+self3) prime + 1) = estimate
ifFalse: [^self A187813With: x].
ifTrue: [^self A187813With: x + 4].
^x
[End]


CROSSREFS



KEYWORD

nonn,base


AUTHOR



STATUS

approved



