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.

A030157 Even numbers k such that in k^2 the parity of digits alternates.

This page as a plain text file.
%I A030157 #20 Sep 11 2024 17:03:05
%S A030157 0,2,4,6,16,26,36,74,84,96,204,264,296,384,404,426,574,584,606,726,
%T A030157 736,764,874,884,964,1464,1584,1596,1704,2036,2074,2084,2184,2916,
%U A030157 2926,2964,3306,3536,3764,3816,4116,4264,4306,5684,5726,5736,5874
%N A030157 Even numbers k such that in k^2 the parity of digits alternates.
%H A030157 Giovanni Resta, <a href="/A030157/b030157.txt">Table of n, a(n) for n = 1..10000</a> (first 2000 terms from Robert Israel)
%p A030157 alp:= proc(n) local L,d;
%p A030157 L:= convert(n,base,10);
%p A030157 d:= nops(L);
%p A030157 if d::even then L:= L + map(op, [[0,1]$(d/2)]) else L:= L + map(op, [[0,1]$((d-1)/2),[0]]) fi;
%p A030157 nops(convert(L mod 2, set))=1
%p A030157 end proc:
%p A030157 select(t -> alp(t^2), [seq(i,i=0..10000,2)]); # _Robert Israel_, Aug 15 2018
%t A030157 id[n_]:=IntegerDigits[n^2]; t={}; Do[If[Length[id[n]]==1, AppendTo[t, n], If[Union[Abs[Differences[Boole/@EvenQ[id[n]]]]]=={1}, AppendTo[t, n]]], {n, 0, 6000, 2}]; t (* _Vincenzo Librandi_, Aug 15 2018 *)
%t A030157 Join[{0,2},Select[Range[0,6000,2],Union[Abs[Differences[Boole[OddQ[ IntegerDigits[ #^2]]]]]] == {1}&]] (* _Harvey P. Dale_, Sep 11 2024 *)
%Y A030157 Cf. A030158 (the squares).
%K A030157 nonn,base
%O A030157 1,2
%A A030157 _Patrick De Geest_
%E A030157 Offset changed by _Robert Israel_, Aug 15 2018