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.
%I A187813 #72 Mar 24 2025 10:21:43 %S A187813 0,1,2,4,8,14,30,32,38,42,44,54,60,62,74,84,90,98,102,104,108,110,114, %T A187813 128,138,140,150,152,158,164,168,174,180,182,194,198,200,212,224,228, %U A187813 230,234,240,242,252,270,278,282,284,294,308,312,314,318,332,338,348 %N A187813 Numbers n whose base-b digit sum is not b for all bases b >= 2. %C A187813 Except for 1, every number is even. %C A187813 No number ends in 6. %C A187813 Numbers neither in A018900 nor in A226636 nor in A226969 nor in A227062 nor in A227080 nor ... . - _R. J. Mathar_, Sep 02 2013 %C A187813 From _Hieronymus Fischer_, Mar 27 2014, May 09 2014: (Start) %C A187813 A079696 and this sequence have no terms in common. %C A187813 Numbers which satisfy m == 1 (mod j) and m > j^2 for any j > 1 are not terms. %C A187813 Example 1: m = 10^k, k>1, is not a term since 10^k == 1 (mod 9) and 10^k > 9^2. %C A187813 Example 2: m = 1 + 3k, k > 3, is not a term, since m > 3(1+3) > 3^2. %C A187813 This is the complement of the disjunction of A079696 with A239708. %C A187813 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. %C A187813 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. %C A187813 (End) %H A187813 Hieronymus Fischer, <a href="/A187813/b187813.txt">Table of n, a(n) for n = 1..10000</a> %F A187813 From _Hieronymus Fischer_, Mar 27 2014: (Start) %F A187813 A239703(a(n)) = 0. %F A187813 a(n+1) = min (p > a(n) | A239703(p) = 0) %F A187813 [for a Smalltalk implementation see Prog section, method A187813NextTerm version 1]. %F A187813 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))) %F A187813 [for a Smalltalk implementation see Prog section, method A187813NextTerm version 2]. %F A187813 a(n) > Prime(n), for n > 5. %F A187813 a(n - m) < Prime(n), for n > 1, where m := i*(i-1)/2 + j - 1, i := floor(log_2(Prime(n))), j := floor(log_2(Prime(n) - 2^i)). %F A187813 a(n - m) < Prime(n), for n > 32, where m := i*(i-1)/2 + j - 16 with i and j above. %F A187813 a(n) = Prime(n + m - 3) + 1, where m = max ( k | A239708(k) < a(n)), n > 3. %F A187813 Remark: This identity can be used to calculate a(n) recursively. For a Smalltalk implementation see Prog section, methods A187813rec and A187813With: estimate. %F A187813 With same conditions: a(n) = A008864(n + m - 3). %F A187813 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. %F A187813 (End) %e A187813 8 has binary expansion (1,0,0,0) whose digit sum 1 is not 2, %e A187813 ternary expansion (2,2) whose digit sum 4 is not 3, %e A187813 quaternary expansion (2,0) whose digit sum 2 is not 4, %e A187813 5-ary expansion (1,3) whose digit sum 4 is not 5, %e A187813 6-ary expansion (1,2) whose digit sum 3 is not 6, %e A187813 7-ary expansion (1,1) whose digit sum 2 is not 7, %e A187813 8-ary expansion (1,0) whose digit sum 1 is not 8, %e A187813 and b-ary expansion (8) when b>8 whose digit sum is 8 not b. Therefore, 8 is in the sequence. %e A187813 3 has binary expansion (1,1) whose digit sum is 2, so 3 is not in the sequence. %e A187813 From _Hieronymus Fischer_, Apr 10 2014: (Start) %e A187813 a(10) = 42 (the 13th prime + 1) %e A187813 a(100) = 618 (the 113th prime + 1) %e A187813 a(1000) = 8172 (the 1026th prime + 1) %e A187813 a(10^4) = 105254 (the 10042nd prime + 1) %e A187813 a(10^5) = 1300464 (the 100056th prime + 1) %e A187813 a(10^6) = 15486872 (the 1000063th prime + 1) %e A187813 a(10^7) = 179425944 (the 10000071st prime + 1) %e A187813 a(10^8) = 2038076324 (the 10^8 +84th prime + 1) %e A187813 a(10^9) = 22801765334 (the 10^9 +92nd prime + 1) %e A187813 a(10^10) = 252097803264 (the 10^10 +102nd prime + 1) %e A187813 [calculation for large numbers processed with Smalltalk method A187813With: estimate; see Prog section] %e A187813 (End) %t A187813 Q@n_:=AllTrue[Table[{b,Plus@@IntegerDigits[n,b]},{b,2,n}],#[[1]]!=#[[2]]&]; %t A187813 Select[Range[0, 1000], Q] (* _Hans Rudolf Widmer_, Oct 08 2022 *) %o A187813 (Sage) %o A187813 n=1000 #change n for more terms %o A187813 S=[] %o A187813 for i in [0..n]: %o A187813 test=False %o A187813 for b in [2..i]: %o A187813 if sum(Integer(i).digits(base=b))==b: %o A187813 test=True %o A187813 break %o A187813 if not test: %o A187813 S.append(i) %o A187813 S %o A187813 # From _Hieronymus Fischer_, Apr 10 2014: (Start) %o A187813 (Smalltalk) %o A187813 A187813NextTerm %o A187813 "Calculates the next term of A187813 greater than the receiver, i.e., calculates a(n+1) from a(n). %o A187813 Usage: a(n) A187813NextTerm %o A187813 Answer: a(n+1) %o A187813 Version 1: Using numOfBasesWithDigitalSumEQBase from A239703 ==> fast calculation, since only the divisors of <an> have to tested to be candidates for bases b with base-b digital sum equal to b" %o A187813 | an | %o A187813 an := self + 1. %o A187813 [an numOfBasesWithDigitalSumEQBase > 0] %o A187813 whileTrue: [an := an+1]. %o A187813 ^an %o A187813 ----------- %o A187813 A187813NextTerm %o A187813 "Calculates the next term of A187813 greater than the receiver, i.e., calculates a(n+1) from a(n). %o A187813 Usage: a(n) A187813NextTerm %o A187813 Answer: a(n+1) %o A187813 Version 2: Using the equivalence with A008864 and A239708 ==> even much more faster calculation" %o A187813 | p q | %o A187813 self < 0 ifTrue: [^0]. %o A187813 self = 0 ifTrue: [^1]. %o A187813 self = 1 ifTrue: [^2]. %o A187813 p := (self - 1) nextPrime. %o A187813 q := p+1-(2 raisedToInteger: (p+1 integerFloorLog: 2)). %o A187813 [q > 0 and: [(2 raisedToInteger: (q integerFloorLog: 2)) - q = 0]] whileTrue: [p := p nextPrime. %o A187813 q := p + 1 - (2 raisedToInteger: (p + 1 integerFloorLog: 2))]. %o A187813 ^p + 1 %o A187813 ----------- %o A187813 A187813 %o A187813 "Calculates the n-th term of A187813, iteratively. %o A187813 Usage: n A187813 %o A187813 Answer: a(n)" %o A187813 | an n | %o A187813 n := self. %o A187813 n < 3 ifTrue: [^#(0 1) at: n]. %o A187813 an := 2. %o A187813 4 to: n do: [:i |an := an A187813NextTerm]. %o A187813 ^an %o A187813 ----------- %o A187813 A187813rec %o A187813 "Calculates the n-th term of A187813, using the recursive method <A187813With: param> %o A187813 Usage: n A187813 %o A187813 Answer: a(n)" %o A187813 self < 3 ifTrue: [^#(0 1) at: self]. %o A187813 ^self A187813With: self prime %o A187813 ----------- %o A187813 A187813With: estimate %o A187813 "Method to calculate the n-th term of A187813 based on the value estimate, recursively. The n-th prime is a adequate estimate. Valid for n > 2. %o A187813 Usage: n A187813With: estimate %o A187813 Answer: a(n)" %o A187813 | x m | %o A187813 (x:=((m:= estimate A239708inv)+self-3) prime + 1) = estimate %o A187813 ifFalse: [^self A187813With: x]. %o A187813 (m + 1) A239708 = x %o A187813 ifTrue: [^self A187813With: x + 4]. %o A187813 ^x %o A187813 [End] %o A187813 (Python) %o A187813 from itertools import count, islice %o A187813 from sympy import isprime %o A187813 def A187813_gen(startvalue=0): # generator of terms >= startvalue %o A187813 yield from filter(lambda n:n<3 or (isprime(n-1) and n.bit_count()!=2), count(max(startvalue,0))) %o A187813 A187813_list = list(islice(A187813_gen(startvalue=20),30)) # _Chai Wah Wu_, Mar 24 2025 %Y A187813 Cf. A018900, A052224. %Y A187813 Cf. A007953, A079696, A008864, A239708, A000040. %Y A187813 Cf. A239703, A239705. %K A187813 nonn,base %O A187813 1,3 %A A187813 _Tom Edgar_, Aug 30 2013