login
A355593
a(n) is the number of alternating integers that divide n.
6
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, 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, 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
OFFSET
1,2
COMMENTS
This sequence first differs from A355302 at index 13, where a(13) = 1 while A355302(13) = 2.
This sequence first differs from A332268 at index 14, where a(14) = 4 while A332268(14) = 3.
LINKS
FORMULA
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
EXAMPLE
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.
MAPLE
Alt:= [$1..9, seq(seq(10*i+r - (i mod 2), r=[1, 3, 5, 7, 9]), i=1..9)]:
V:= Vector(100):
for t in Alt do J:= [seq(i, i=t..100, t)]; V[J]:= V[J] +~ 1 od:
convert(V, list); # Robert Israel, Nov 26 2023
MATHEMATICA
q[n_] := !MemberQ[Differences[Mod[IntegerDigits[n], 2]], 0]; a[n_] := DivisorSum[n, 1 &, q[#] &]; Array[a, 120] (* Amiram Eldar, Jul 08 2022 *)
PROG
(Python)
from sympy import divisors
def p(d): return 0 if d in "02468" else 1
def c(n):
if n < 10: return True
s = str(n)
return all(p(s[i]) != p(s[i+1]) for i in range(len(s)-1))
def a(n): return sum(1 for d in divisors(n, generator=True) if c(d))
print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Jul 08 2022
(PARI) alternate(n, d=digits(n))=for(i=2, #d, if((d[i]-d[i-1])%2==0, return(0))); 1
a(n)=sumdiv(n, d, alternate(d)) \\ Charles R Greathouse IV, Jul 08 2022
CROSSREFS
Cf. A030141 (alternating integers), A355594, A355595, A355596.
Similar to A332268 (with Niven numbers) and A355302 (with undulating integers).
Sequence in context: A358099 A095048 A332268 * A355302 A084302 A289872
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jul 08 2022
STATUS
approved