login
Number of bases b for which the absolute value of the base-b alternate digital sum of n is b.
4

%I #18 Oct 26 2014 04:54:52

%S 1,0,1,0,2,0,1,0,1,1,2,0,1,0,1,0,2,0,3,1,1,0,3,0,1,0,1,0,3,0,1,0,2,2,

%T 1,0,1,0,2,1,2,0,2,0,1,1,2,0,2,0,1,0,3,1,2,0,2,1,3,0,2,0,1,0,2,0,1,1,

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

%N Number of bases b for which the absolute value of the base-b alternate digital sum of n is b.

%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.

%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 is 0 if n is even, and is 1 if n is odd.

%C For odd n we have altDigitSum_1(n) = 1, and thus a(n) >= 1.

%C We have |altDigitSum_b(n)| < b for bases b that satisfy b > b0 := floor((sqrt(4n+5) - 1)/2), and thus a(n) <= b0.

%C It follows from A239704 and A239705 that there are infinitely many n that satisfy |altDigitSum_b(n)| = b for a base b > 1. Consequently, a(n) >= 2 for n = 5, 11, 19, 29, 41, ... (oblong numbers minus 1 starting with the third such number) and a(n) >= 1 for n = 10, 33, 76, 145, 246, ... (sums of cubes and oblong numbers, starting with 2^3 + the second oblong number, see A002378).

%C If b is a base such that the absolute value of the base-b alternate digital sum of n is b, then b + 1 is a divisor of n + 1 or of n - 1.

%C a(b*n) > (b*n) mod 2 for all b > 1 which satisfy altDigitSum_b(n) = -b.

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

%C The first n with a(n) = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ... are n = 1, 5, 19, 89, 83, 359, 419, 629, 839, 3359, ... .

%C a(n) = 0, if n is in the middle of a twin prime pair i.e., if n - 1 and n + 1 are primes.

%H Hieronymus Fischer, <a href="/A239706/b239706.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = A239704(n) + A239705(n).

%F a(n) > max(A239704(n), A239705(n)) for n = 9*2^k - 3, k = 2, 3, 4, ... .

%F a(A002378(n)-1) >= 2, n > 1.

%F a(n) > max(A239704(n), A239705(n)) for n = 9*2^k - 3, k = 2, 3, 4, ... .

%F a(n) < floor(sigma_0(n-1)/2) + floor(sigma_0(n+1)/2).

%e a(1) = 1, since |altDigitSum_1(1)| = 1 and |altDigitSum_b(1)| = 1 <> b for all b > 1.

%e a(2) = 0, 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 <> b for all b > 2.

%e a(33) = 3, since |altDigitSum_1(33)| = 1, and |altDigitSum_2(33)| = 0 (because of 33 = 100001_2), and |altDigitSum_3(33)| = 3 (because of 33 = 1020_3), and |altDigitSum_b(33)| <> b for all other b > 3.

%o (Smalltalk)

%o "Answer the number of bases b for which the absolute value of

%o the alternate digital sum of n in base b is b.

%o Valid for bases b > 0.

%o Using methods which are defined in A239704 and A239705.

%o Usage: n A239706

%o Answer: a(n)"

%o A239706

%o ^self numOfBasesWithAltDigitalSumEQBase +

%o self numOfBasesWithAltDigitalSumEQNegBase

%o [by _Hieronymus Fischer_, May 08 2014]

%Y Cf. A055017, A225693, A187813.

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

%Y Cf. A002378, A008864, A000040, A000005.

%K nonn

%O 1,5

%A _Hieronymus Fischer_, May 08 2014