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 A239707 #30 Sep 20 2018 00:30:51 %S A239707 0,1,1,2,1,3,1,3,2,3,1,5,1,3,3,4,1,5,1,4,2,3,1,7,2,3,3,5,1,7,1,5,3,3, %T A239707 2,8,1,3,3,7,1,6,1,5,5,3,1,9,2,4,3,5,1,6,2,7,3,3,1,10,1,3,5,6,3,7,1,5, %U A239707 2,7,1,11,1,3,5,5,2,6,1,9,3,3,1,9,3,3,2,7,1,11,3,4,2,3,3,11,1,5,5,7 %N A239707 Number of bases b for which the base-b alternate digital sum of n is 0. %C A239707 For the definition of the alternate digital sum, see A055017 or A225693. %C A239707 For reference: we write altDigitSum_b(x) for the base-b alternate digital sum of x according to A055017 (with a general base b). %C A239707 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 of n is 0, if n is even, and is 1, if n is odd. If we exclude the base b = 1, the resulting sequence is 0, 0, 1, 1, 1, 2, 1, 2, 2, 2, 1, 4, 1, 2, ... . The properties of this sequence are very similar, but the relation to the prime numbers is less strict. %C A239707 For b := n - 1, we get altDigitSum_b(n) = 0, thus a(n) >= 1 for all n > 1. %C A239707 For even n > 2, we get altDigitSum_1(n) = 0, thus a(n) >= 2. %C A239707 For bases b which satisfy floor(n/2) < b < n - 1, we have altDigitSum_b(n)> 0, thus floor((n+2)/2) is a upper bound for a(n). %C A239707 If b is a base such that the base-b alternate digital sum of n is 0, then b + 1 is a divisor of n, thus the number of such bases is limited by the number of divisors of n (see Formula section). %C A239707 If b + 1 is a divisor of n which satisfy b + 1 >= sqrt(n), then altDigitSum_b(n) = 0. This leads to a lower bound for a(n) (see Formula section). %C A239707 If b + 1 is a divisor of n, then b is not necessarily a base such that the base-b alternate digital sum of n is 0. Example: 4, 5 and 8 are divisors of 200, but altDigitSum_3(200) = 4, altDigitSum_4(200) = -5, altDigitSum_7(200) = 8. %C A239707 The first n with a(n) = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... are n = 2, 4, 6, 16, 12, 42, 24, 36, 48, 60, ... . %H A239707 Hieronymus Fischer, <a href="/A239707/b239707.txt">Table of n, a(n) for n = 1..10000</a> %F A239707 a(n) = 0, if and only if n=1. %F A239707 a(n) = 1, if and only if n is a prime number. %F A239707 a(n) > 1, if and only if n is a composite number. %F A239707 a(n) = 2, if and only if n is the product of two primes (including squares of primes). %F A239707 a(n) <= sigma_0(n) - 1, equality holds at least for primes and squares of primes. %F A239707 a(n) >= floor((sigma_0(n) + 1)/2), for n > 1. %e A239707 a(1) = 0, since altDigitSum_b(1) > 0 for all b > 0. %e A239707 a(2) = 1, 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 for all b > 2. %e A239707 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 for all b > 3. %e A239707 a(4) = 2, since altDigitSum_1(4) = 0 (because of 3 = 1111_1), and altDigitSum_2(4) = 1 (because of 4 = 100_2), and altDigitSum_3(4) = 0 (because of 4 = 11_3), and altDigitSum_4(4) = -1 (because of 4 = 10_4), and altDigitSum_b(4) = 3 for all b > 4. %o A239707 (Smalltalk) %o A239707 "> Version 1: simple calculation for small numbers. %o A239707 Answer the number of bases b for which the alternate digital sum of n in base b is 0. %o A239707 Valid for bases b > 0. %o A239707 Using altDigitalSumRight from A055017. %o A239707 Usage: n numOfBasesWithAltDigitalSumEQ0 %o A239707 Answer: a(n)" %o A239707 numOfBasesWithAltDigitalSumEQ0 %o A239707 | b q numBases | %o A239707 self < 2 ifTrue: [^0]. %o A239707 numBases := 1. %o A239707 q := self // 2. %o A239707 b := 1. %o A239707 [b < q] whileTrue:[ %o A239707 (self altDigitalSumRight: b) = 0 %o A239707 ifTrue: [numBases := numBases + 1]. %o A239707 b := b + 1]. %o A239707 ^numBases %o A239707 ----------- %o A239707 "> Version 2: accelerated calculation for large numbers. %o A239707 Answer the number of bases b for which the alternate digital sum of n in base b is 0. %o A239707 Valid for bases b > 0. %o A239707 Using altDigitalSumRight from A055017. %o A239707 Usage: n numOfBasesWithAltDigitalSumEQ0 %o A239707 Answer: a(n)" %o A239707 numOfBasesWithAltDigitalSumEQ0 %o A239707 | numBases div b | %o A239707 div := self divisors. %o A239707 numBases := 0. %o A239707 2 to: div size do: [ :i | b := (div at: i) - 1. %o A239707 (self altDigitalSumRight: b) = 0 %o A239707 ifTrue: [numBases := numBases + 1]]. %o A239707 ^numBases %Y A239707 Cf. A055017, A225693, A187813. %Y A239707 Cf. A239703, A239704, A239705, A239706. %Y A239707 Cf. A000040, A000005 (definition of sigma_0(n)). %K A239707 nonn %O A239707 1,4 %A A239707 _Hieronymus Fischer_, Mar 31 2014