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
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
For the definition of the alternate digital sum, see A055017 or A225693.
For reference: we write altDigitSum_b(x) for the base-b alternate digital sum of x according to A055017 (with a general base b).
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.
For b := n - 1, we get altDigitSum_b(n) = 0, thus a(n) >= 1 for all n > 1.
For even n > 2, we get altDigitSum_1(n) = 0, thus a(n) >= 2.
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).
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).
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).
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.
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, ... .
LINKS
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.
EXAMPLE
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.
PROG
(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
CROSSREFS
Cf. A000040, A000005 (definition of sigma_0(n)).
Sequence in context: A304793 A199570 A350338 * A294928 A325770 A305611
KEYWORD
nonn
AUTHOR
Hieronymus Fischer, Mar 31 2014
STATUS
approved

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 15:04 EDT 2024. Contains 371914 sequences. (Running on oeis4.)