[go: up one dir, main page]

login

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”).

A355596
Numbers all of whose divisors are alternating numbers (A030141).
3
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 21, 23, 25, 27, 29, 32, 36, 41, 43, 47, 49, 50, 54, 58, 61, 63, 67, 69, 81, 83, 87, 89, 94, 98, 101, 103, 107, 109, 123, 125, 127, 129, 141, 145, 147, 149, 161, 163, 167, 181, 183, 189, 214, 218, 250, 254, 290, 298
OFFSET
1,2
COMMENTS
The smallest alternating number that is not a term is 30, because of 15.
EXAMPLE
32 is a term since all the divisors of 32, i.e., 1, 2, 4, 8, 16 and 32, are alternating numbers
MATHEMATICA
q[n_] := AllTrue[Divisors[n], !MemberQ[Differences[Mod[IntegerDigits[#], 2]], 0] &]; Select[Range[300], q] (* Amiram Eldar, Jul 12 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 ok(n):
return c(n) and all(c(d) for d in divisors(n, generator=True))
print([k for k in range(1, 200) if ok(k)]) # Michael S. Branicky, Jul 12 2022
(PARI) isokd(n, d=digits(n))=for(i=2, #d, if((d[i]-d[i-1])%2==0, return(0))); 1; \\ A030141
isok(m) = sumdiv(m, d, isokd(d)) == numdiv(m); \\ Michel Marcus, Jul 12 2022
CROSSREFS
Subsequence of A030141.
Similar sequences: A062687, A190217, A329419, A337941.
Sequence in context: A292514 A030141 A242367 * A246077 A064915 A375969
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Jul 12 2022
EXTENSIONS
a(51) and beyond from Michael S. Branicky, Jul 12 2022
STATUS
approved