login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A239707 Number of bases b for which the base-b alternate digital sum of n is 0. 6

%I #30 Sep 20 2018 00:30:51

%S 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 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 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 Number of bases b for which the base-b alternate digital sum of n is 0.

%C For the definition of the alternate digital sum, see A055017 or A225693.

%C 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 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 For b := n - 1, we get altDigitSum_b(n) = 0, thus a(n) >= 1 for all n > 1.

%C For even n > 2, we get altDigitSum_1(n) = 0, thus a(n) >= 2.

%C 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 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 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 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 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 Hieronymus Fischer, <a href="/A239707/b239707.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 0, if and only if n=1.

%F a(n) = 1, if and only if n is a prime number.

%F a(n) > 1, if and only if n is a composite number.

%F a(n) = 2, if and only if n is the product of two primes (including squares of primes).

%F a(n) <= sigma_0(n) - 1, equality holds at least for primes and squares of primes.

%F a(n) >= floor((sigma_0(n) + 1)/2), for n > 1.

%e a(1) = 0, since altDigitSum_b(1) > 0 for all b > 0.

%e 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 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 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 (Smalltalk)

%o "> Version 1: simple calculation for small numbers.

%o Answer the number of bases b for which the alternate digital sum of n in base b is 0.

%o Valid for bases b > 0.

%o Using altDigitalSumRight from A055017.

%o Usage: n numOfBasesWithAltDigitalSumEQ0

%o Answer: a(n)"

%o numOfBasesWithAltDigitalSumEQ0

%o | b q numBases |

%o self < 2 ifTrue: [^0].

%o numBases := 1.

%o q := self // 2.

%o b := 1.

%o [b < q] whileTrue:[

%o (self altDigitalSumRight: b) = 0

%o ifTrue: [numBases := numBases + 1].

%o b := b + 1].

%o ^numBases

%o -----------

%o "> Version 2: accelerated calculation for large numbers.

%o Answer the number of bases b for which the alternate digital sum of n in base b is 0.

%o Valid for bases b > 0.

%o Using altDigitalSumRight from A055017.

%o Usage: n numOfBasesWithAltDigitalSumEQ0

%o Answer: a(n)"

%o numOfBasesWithAltDigitalSumEQ0

%o | numBases div b |

%o div := self divisors.

%o numBases := 0.

%o 2 to: div size do: [ :i | b := (div at: i) - 1.

%o (self altDigitalSumRight: b) = 0

%o ifTrue: [numBases := numBases + 1]].

%o ^numBases

%Y Cf. A055017, A225693, A187813.

%Y Cf. A239703, A239704, A239705, A239706.

%Y Cf. A000040, A000005 (definition of sigma_0(n)).

%K nonn

%O 1,4

%A _Hieronymus Fischer_, Mar 31 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 08:33 EDT 2024. Contains 371905 sequences. (Running on oeis4.)