cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A355596 Numbers all of whose divisors are alternating numbers (A030141).

This page as a plain text file.
%I A355596 #16 Jul 14 2022 12:08:35
%S A355596 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,
%T A355596 54,58,61,63,67,69,81,83,87,89,94,98,101,103,107,109,123,125,127,129,
%U A355596 141,145,147,149,161,163,167,181,183,189,214,218,250,254,290,298
%N A355596 Numbers all of whose divisors are alternating numbers (A030141).
%C A355596 The smallest alternating number that is not a term is 30, because of 15.
%e A355596 32 is a term since all the divisors of 32, i.e., 1, 2, 4, 8, 16 and 32, are alternating numbers
%t A355596 q[n_] := AllTrue[Divisors[n], !MemberQ[Differences[Mod[IntegerDigits[#], 2]], 0] &]; Select[Range[300], q] (* _Amiram Eldar_, Jul 12 2022 *)
%o A355596 (Python)
%o A355596 from sympy import divisors
%o A355596 def p(d): return 0 if d in "02468" else 1
%o A355596 def c(n):
%o A355596     if n < 10: return True
%o A355596     s = str(n)
%o A355596     return all(p(s[i]) != p(s[i+1]) for i in range(len(s)-1))
%o A355596 def ok(n):
%o A355596     return c(n) and all(c(d) for d in divisors(n, generator=True))
%o A355596 print([k for k in range(1, 200) if ok(k)]) # _Michael S. Branicky_, Jul 12 2022
%o A355596 (PARI) isokd(n, d=digits(n))=for(i=2, #d, if((d[i]-d[i-1])%2==0, return(0))); 1; \\ A030141
%o A355596 isok(m) = sumdiv(m, d, isokd(d)) == numdiv(m); \\ _Michel Marcus_, Jul 12 2022
%Y A355596 Subsequence of A030141.
%Y A355596 Cf. A355593, A355594, A355595.
%Y A355596 Similar sequences: A062687, A190217, A329419, A337941.
%K A355596 nonn,base
%O A355596 1,2
%A A355596 _Bernard Schott_, Jul 12 2022
%E A355596 a(51) and beyond from _Michael S. Branicky_, Jul 12 2022