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 A239704 #16 Oct 26 2014 04:55:49 %S A239704 1,0,1,0,2,0,1,0,1,0,2,0,1,0,1,0,2,0,3,1,1,0,3,0,1,0,1,0,3,0,1,0,1,1, %T A239704 1,0,1,0,2,0,2,0,1,0,1,0,2,0,2,0,1,0,3,1,2,0,1,0,3,0,1,0,1,0,2,0,1,1, %U A239704 1,0,3,0,1,0,1,1,3,0,1,1,1,0,5,0,1,1,1,0,4,0,2,1,1,0,3,0,1,0,3,0 %N A239704 Number of bases b for which the base-b alternate digital sum of n is b. %C A239704 For the definition of the alternate digital sum, see A055017 or A225693. %C A239704 For reference: we write altDigitSum_b(x) for the base-b alternate digital sum of x according to A055017. %C A239704 The number of counted bases includes the special base 1. The base-1 expansion of a natural number is defined as 1=1_1, 2=11_1, 3=111_1 and so on. As a result, the base-1 alternate digital sum is 0 if n is even, and is 1 if n is odd. %C A239704 For odd n we have altDigitSum_1(n) = 1, and thus a(n) >= 1. %C A239704 The altDigitSum_b(n) is < b for bases b that satisfy b > b0 := floor((sqrt(4n+5) - 1)/2), and thus a(n) <= b0. This boundary can also be expressed as b0 := floor(sqrt(n - floor(sqrt(n)) + 1)). %C A239704 If n + 1 is an oblong number (see A002378), then b := (sqrt(4n+5) - 1)/2 is an integer equal to b0 and b^2 + b - 1 = n. This implies altDigitSum_b(n) = 1 + 0 + b - 1 = b and shows, that there are infinitely many n with a base b > 1 such that altDigitSum_b(n) = b. It follows a(n) >= 2 for n = 5, 11, 19, 29, 41, ... (since those n are odd). %C A239704 Moreover, a(n) >= 2 is also true for n == b(b+1)-1 (mod (b+1)b^3), b>1. %C A239704 Example 1: altDigitSum_2(n) = 2 for n == 5 (mod 24). %C A239704 Example 2: altDigitSum_3(n) = 3 for n == 11 (mod 108). %C A239704 Example 3: altDigitSum_4(n) = 4 for n == 19 (mod 320). %C A239704 If b is a base such that the base-b alternate digital sum of n is b, then b + 1 is a divisor of n + 1. Thus the number of such bases is also limited by the number of divisors of n + 1 (see formula section). %C A239704 If b + 1 is a divisor of n + 1, then b is not necessarily a base such that base-b alternate digital sum of n is b. Example: 2, 3, 4, 6 and 12 are divisors of 12, and altDigitSum_1(11) = 1, altDigitSum_3(11) = 3, but altDigitSum_2(11) = -1, altDigitSum_5(11) = -1, altDigitSum_11(11) = -1. %C A239704 a(b*n) > (b*n) mod 2 for all b > 1 which satisfy altDigitSum_b(n) = -b. %C A239704 Example 4: altDigitSum_2(10) = -2, hence a(2*10) > 0 %C A239704 Example 5: altDigitSum_3(33) = -3, hence a(3*33) > 1 %C A239704 The first n with a(n) = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... are n = 1, 5, 19, 89, 83, 359, 419, 1259, 839, 3359, ... . %H A239704 Hieronymus Fischer, <a href="/A239704/b239704.txt">Table of n, a(n) for n = 1..10000</a> %F A239704 a(A002378(n)-1) = a(n^2+n-1) >= 2, for n > 1. %F A239704 a(n) = 0, if n + 1 is a prime. %F A239704 a(n) <= floor(sigma_0(n+1)/2). %e A239704 a(1) = 1, since altDigitSum_1(1) = 1 and altDigitSum_b(1) = 1 < b for all b > 1. %e A239704 a(2) = 0, since altDigitSum_1(2) = 0 (because of 2 = 11_1), and altDigitSum_2(2) = -1 (because of 2 = 10_2), and altDigitSum_b(2) = 2 < b for all b > 2. %e A239704 a(3) = 1, since altDigitSum_1(3) = 1 (because of 3 = 111_1), and altDigitSum_2(3) = 0 (because of 3 = 11_2), and altDigitSum_3(3) = -1 (because of 3 = 10_3), and altDigitSum_b(3) = 3 < b for all b > 3. %e A239704 a(5) = 2, since altDigitSum_1(5) = 1 (because of 5 = 11111_1), and altDigitSum_2(5) = 2 (because of 5 = 101_2), and altDigitSum_3(5) = 1 (because of 5 = 12_3), and altDigitSum_4(5) = 0 (because of 5 = 11_4), and altDigitSum_5(5) = 1 (because of 5 = 10_5), and altDigitSum_b(5) = 5 < b for all b > 5. %o A239704 (Smalltalk) %o A239704 "> Version 1: simple calculation for small numbers. %o A239704 Answer the number of bases b for which the alternate %o A239704 digital sum of n in base b is b. Valid for bases b > 0. %o A239704 Usage: n numOfBasesWithAltDigitalSumEQ0 %o A239704 Answer: a(n)" %o A239704 numOfBasesWithAltDigitalSumEQBase %o A239704 | b q numBases | %o A239704 self < 2 ifTrue: [^0]. %o A239704 numBases := 1. %o A239704 q := self sqrtTruncated. %o A239704 b := 1. %o A239704 [b < q] whileTrue:[ %o A239704 (self altDigitalSumRight: b) = 0 %o A239704 ifTrue: [numBases := numBases + 1]. %o A239704 b := b + 1]. %o A239704 ^numBases %o A239704 [by _Hieronymus Fischer_, May 08 2014] %o A239704 ----------- %o A239704 (Smalltalk) %o A239704 "> Version 2: accelerated calculation for large numbers. %o A239704 Answer the number of bases b for which the alternate %o A239704 digital sum of n in base b is b." %o A239704 numOfBasesWithAltDigitalSumEQBase %o A239704 | numBases div b bsize | %o A239704 div := (self + 1) divisors. %o A239704 numBases := 0. %o A239704 bsize := div size // 2 + 1. %o A239704 2 to: bsize %o A239704 do: %o A239704 [:i | %o A239704 b := (div at: i) - 1. %o A239704 [(self altDigitalSumRight: b) = b %o A239704 ifTrue: [numBases := numBases + 1]]]. %o A239704 ^numBases %o A239704 [by _Hieronymus Fischer_, May 08 2014] %Y A239704 Cf. A055017, A225693, A187813. %Y A239704 Cf. A239703, A239705, A239706, A239707. %Y A239704 Cf. A002378, A008864, A000040, A000005. %K A239704 nonn %O A239704 1,5 %A A239704 _Hieronymus Fischer_, May 08 2014