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!)
A239703 Number of bases b > 1 for which the base-b digital sum of n is b. 10

%I #30 Oct 25 2014 14:42:21

%S 0,0,0,1,0,2,1,2,0,2,2,2,1,4,0,2,1,3,1,4,1,4,2,1,1,4,1,1,2,4,0,5,0,5,

%T 3,1,2,7,0,2,3,5,0,4,0,4,3,1,1,5,1,3,2,3,0,5,2,6,1,1,0,8,0,2,2,5,3,5,

%U 1,2,2,4,1,8,0,1,4,3,2,4,1,6,3,2,0,10,2

%N Number of bases b > 1 for which the base-b digital sum of n is b.

%C For the definition of the digital sum, see A007953.

%C For reference, we write digitSum_b(x) for the base-b digital sum of x according to A007953 (with general base b).

%C The bases counted exclude 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 digital sum of n is n. The inclusion of base b = 1 would lead to a(1) = 1 instead of a(1) = 0. All other terms remain unchanged.

%C For odd n > 1 and b := (n + 1)/2 we have digitSum_b(n) = b, and thus a(n) >= 1.

%C The digitSum_b(n) is < b for bases b which satisfy b > floor((n+1)/2), and thus a(n) <= floor((n+1)/2).

%C If b is a base such that the base-b digital sum of n is b, then b < n and b - 1 is a divisor of n - 1, thus the number of such bases is limited by the number of divisors of n - 1 (see formula section).

%C If p < n - 1 is a divisor of n - 1 which satisfy p >= sqrt(n - 1), then digitSum_b(n) = b for b := p + 1. This leads to a lower bound for a(n) (see formula section).

%C If b - 1 is a divisor of n - 1, then b is not necessarily a base such that base-b digital sum of n is b. Example: 1, 2, 3, 4, 6, 8, 12, 16, and 24 are the divisors < 48 of 48, but digitSum_2(49) = 3, digitSum_3(49) = 5, digitSum_5(49) = 9, digitSum_7(49) = 1.

%C a(b*n) > 0 for all b > 1 which satisfy digitSum_b(n) = b.

%C Example 1: digitSum_2(3) = 2, hence a(2*3) > 0.

%C Example 2: digitSum_3(5) = 3, hence a(3*5) > 0.

%C The first n with a(n) = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... are n = 3, 5, 17, 13, 31, 57, 37, 61, 81, 85, ... .

%H Hieronymus Fischer, <a href="/A239703/b239703.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = 0, if and only if n is a term of A187813.

%F a(A187813(n)) = 0.

%F a(A239708(n)) = 1, for n > 0.

%F a(A018900(n)) > 0, for n > 0.

%F a(A079696(n)) > 0, for n > 0.

%F a(A008864(n)) <= 1, for n > 0.

%F a(n) <= 1, if n - 1 is a prime.

%F a(n) <= sigma_0(n - 1) - 1, for n > 1.

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

%e a(1) = 1, since digitSum_1(1) = 1 and digitSum_b(1) <> b for all b > 1.

%e a(2) = 0, since digitSum_1(2) = 2 (because of 2 = 11_1), and digitSum_2(2) = 1 (because of 2 = 10_2), and digitSum_b(2) = 2 for all b > 2.

%e a(3) = 1, since digitSum_1(3) = 3 (because of 3 = 111_1), and digitSum_2(3) = 2 (because of 3 = 11_2), and digitSum_3(3) = 1 (because of 3 = 10_3), and digitSum_b(3) = 3 for all b > 3.

%e a(5) = 2, since digitSum_1(5) = 5 (because of 5 = 11111_1), and digitSum_2(5) = 2 (because of 5 = 101_2), and digitSum_3(5) = 3 (because of 5 = 12_3), and digitSum_4(5) = 2 (because of 5 = 11_4), and digitSum_5(5) = 1 (because of 5 = 10_5), and digitSum_b(5) = 5 for all b > 5.

%o (Smalltalk)

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

%o Answer the number of bases b such that the digital sum of n in base b is b.

%o Valid for bases b >= 1, thus returning a(1) = 1.

%o Using digitalSum from A007953.

%o Usage: n numOfBasesWithAltDigitalSumEQBase

%o Answer: a(n)"

%o numOfBasesWithDigitalSumEQBase

%o | numBases b bmax |

%o numBases := 0.

%o bmax := self + 1 // 2.

%o b := 0.

%o [b < bmax] whileTrue: [

%o b := b + 1

%o (self digitalSum: b) = b

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

%o ^numBases

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

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

%o Answer the number of bases b such that the digital sum of n in base b is b.

%o Valid for bases b > 1, thus returning a(1) = 0.

%o Using digitalSum from A007953.

%o Usage: n numOfBasesWithAltDigitalSumEQBase

%o Answer: a(n)"

%o numOfBasesWithDigitalSumEQBase

%o | numBases div b bsize |

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

%o div := (self - 1) divisors.

%o numBases := 0.

%o bsize := div size - 1.

%o 1 to: bsize do: [ :i | b := (div at: i) + 1.

%o (self digitalSum: b) = b

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

%o ^numBases

%Y Cf. A007953, A079696, A008864, A187813, A239707, A239708.

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

%K nonn

%O 0,6

%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 12:08 EDT 2024. Contains 371912 sequences. (Running on oeis4.)