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.

A030477 Numbers k such that k^2 has property that all even digits occur together and all odd digits occur together.

This page as a plain text file.
%I A030477 #19 Oct 27 2024 16:39:25
%S A030477 0,1,2,3,4,5,6,7,8,9,10,12,14,15,17,18,20,21,22,24,25,28,29,30,32,34,
%T A030477 38,40,42,44,45,47,49,51,53,56,58,60,62,65,67,68,72,76,78,79,80,83,86,
%U A030477 88,91,92,93,98,100,102,108,118,120,122,124,132,134,138,140
%N A030477 Numbers k such that k^2 has property that all even digits occur together and all odd digits occur together.
%H A030477 Robert Israel, <a href="/A030477/b030477.txt">Table of n, a(n) for n = 1..10000</a>
%p A030477 filter:= proc(n) local L,x,m;
%p A030477   L:= convert(n^2,base,10) mod 2;
%p A030477   if n::odd then
%p A030477     if not member(0,L,m) then return true fi;
%p A030477     convert(L[m..-1],set) = {0}
%p A030477   else
%p A030477     if not member(1,L,m) then return true fi;
%p A030477     convert(L[m..-1],set) = {1}
%p A030477   fi
%p A030477 end proc:
%p A030477 select(filter, [$0..1000]); # _Robert Israel_, Oct 27 2024
%o A030477 (Python)
%o A030477 def ok(n):
%o A030477     s = "".join("0" if d in "02468" else "1" for d in str(n**2))
%o A030477     return len(set(s.rstrip(s[-1]))) < 2
%o A030477 print([k for k in range(141) if ok(k)]) # _Michael S. Branicky_, Oct 27 2024
%Y A030477 Cf. A030476.
%K A030477 nonn,base
%O A030477 1,3
%A A030477 _Patrick De Geest_