A239707 Number of bases b for which the base-b alternate digital sum of n is 0.
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, 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, 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
Offset: 1
Keywords
Examples
a(1) = 0, since altDigitSum_b(1) > 0 for all b > 0. 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. 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. 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.
Links
- Hieronymus Fischer, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Smalltalk
"> Version 1: simple calculation for small numbers. Answer the number of bases b for which the alternate digital sum of n in base b is 0. Valid for bases b > 0. Using altDigitalSumRight from A055017. Usage: n numOfBasesWithAltDigitalSumEQ0 Answer: a(n)" numOfBasesWithAltDigitalSumEQ0 | b q numBases | self < 2 ifTrue: [^0]. numBases := 1. q := self // 2. b := 1. [b < q] whileTrue:[ (self altDigitalSumRight: b) = 0 ifTrue: [numBases := numBases + 1]. b := b + 1]. ^numBases ----------- "> Version 2: accelerated calculation for large numbers. Answer the number of bases b for which the alternate digital sum of n in base b is 0. Valid for bases b > 0. Using altDigitalSumRight from A055017. Usage: n numOfBasesWithAltDigitalSumEQ0 Answer: a(n)" numOfBasesWithAltDigitalSumEQ0 | numBases div b | div := self divisors. numBases := 0. 2 to: div size do: [ :i | b := (div at: i) - 1. (self altDigitalSumRight: b) = 0 ifTrue: [numBases := numBases + 1]]. ^numBases
Formula
a(n) = 0, if and only if n=1.
a(n) = 1, if and only if n is a prime number.
a(n) > 1, if and only if n is a composite number.
a(n) = 2, if and only if n is the product of two primes (including squares of primes).
a(n) <= sigma_0(n) - 1, equality holds at least for primes and squares of primes.
a(n) >= floor((sigma_0(n) + 1)/2), for n > 1.
Comments