Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #42 Jan 06 2024 09:21:33
%S 1,2,2,3,2,4,2,4,3,4,1,6,1,4,3,5,1,6,1,5,4,2,2,7,3,2,4,5,2,7,1,6,2,3,
%T 3,9,1,3,2,6,2,7,2,3,5,3,2,8,3,6,2,4,1,8,2,7,2,4,1,9,2,2,6,6,3,4,2,4,
%U 4,7,1,11,1,3,4,5,2,5,1,7,5,3,2,9,3,3,4,4,2,11,2,5,2,4,2,10,1,6,3,7
%N a(n) is the number of alternating integers that divide n.
%C This sequence first differs from A355302 at index 13, where a(13) = 1 while A355302(13) = 2.
%C This sequence first differs from A332268 at index 14, where a(14) = 4 while A332268(14) = 3.
%H Robert Israel, <a href="/A355593/b355593.txt">Table of n, a(n) for n = 1..10000</a>
%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Sum_{n>=2} 1/A030141(n) = 5.1... (the sums up to 10^10, 10^11 and 10^12 are 5.1704..., 5.1727... and 5.1738..., respectively). - _Amiram Eldar_, Jan 06 2024
%e 40 has 8 divisors: {1, 2, 4, 5, 8, 10, 20, 40} of which 2 are not alternating integers: {20, 40}, hence a(40) = 8 - 2 = 6.
%p Alt:= [$1..9, seq(seq(10*i+r - (i mod 2), r=[1,3,5,7,9]),i=1..9)]:
%p V:= Vector(100):
%p for t in Alt do J:= [seq(i,i=t..100,t)]; V[J]:= V[J] +~ 1 od:
%p convert(V,list); # _Robert Israel_, Nov 26 2023
%t q[n_] := !MemberQ[Differences[Mod[IntegerDigits[n], 2]], 0]; a[n_] := DivisorSum[n, 1 &, q[#] &]; Array[a, 120] (* _Amiram Eldar_, Jul 08 2022 *)
%o (Python)
%o from sympy import divisors
%o def p(d): return 0 if d in "02468" else 1
%o def c(n):
%o if n < 10: return True
%o s = str(n)
%o return all(p(s[i]) != p(s[i+1]) for i in range(len(s)-1))
%o def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
%o print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Jul 08 2022
%o (PARI) alternate(n,d=digits(n))=for(i=2,#d, if((d[i]-d[i-1])%2==0, return(0))); 1
%o a(n)=sumdiv(n,d,alternate(d)) \\ _Charles R Greathouse IV_, Jul 08 2022
%Y Cf. A030141 (alternating integers), A355594, A355595, A355596.
%Y Similar to A332268 (with Niven numbers) and A355302 (with undulating integers).
%K nonn,base
%O 1,2
%A _Bernard Schott_, Jul 08 2022