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.

Showing 1-3 of 3 results.

A030152 Squares in which parity of digits alternates.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 81, 121, 169, 256, 361, 529, 676, 729, 961, 1296, 4761, 5476, 6561, 7056, 9216, 12321, 12769, 14161, 16129, 18769, 32761, 34969, 41616, 56169, 69696, 72361, 74529, 76729, 78961, 87616, 96721, 147456, 163216, 181476, 212521
Offset: 1

Views

Author

Keywords

Examples

			1296 is a term as 1, 2, 9 and 6 have odd and even parity alternately.
		

Crossrefs

Programs

  • Haskell
    a030152 n = a030152_list !! (n-1)
    a030152_list = filter ((== 1) . a228710) a000290_list
    -- Reinhard Zumkeller, Aug 31 2013
  • Maple
    i := 0:for a from 1 to 1000 do b := a^2:g := ceil(log(b+1)/log(10)):iss := true:for j from 1 to g-1 do if((b mod 2)=1) then if((floor(b/10^j) mod 2)=((-1)^(j+1)+1)/2) then iss := false:end if:else if((floor(b/10^j) mod 2)=((-1)^j+1)/2) then iss := false:end if:end if:end do: if(iss=true) then i := i+1:c[i] := b:end if:end do:q := seq(c[k],k=1..i-1); # Sascha Kurz, Mar 23 2002
  • Mathematica
    altQ[n_] := n < 10 || Union[Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; Select[ Range[0, 500]^2, altQ[#] &] (* Giovanni Resta, Aug 16 2018 *)

Formula

A010052(a(n)) * A228710(a(n)) = 1. - Reinhard Zumkeller, Aug 31 2013

Extensions

Edited by N. J. A. Sloane, Aug 31 2009 at the suggestion of R. J. Mathar
Offset corrected by Reinhard Zumkeller, Aug 31 2013

A030151 Numbers k such that in k^2 the parity of digits alternates.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 19, 23, 26, 27, 31, 36, 69, 74, 81, 84, 96, 111, 113, 119, 127, 137, 181, 187, 204, 237, 264, 269, 273, 277, 281, 296, 311, 384, 404, 426, 461, 463, 539, 574, 584, 606, 661, 673, 677, 689, 726, 736, 764, 819
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    upto=2000;tfs=Flatten[Table[{True,False},{Ceiling[IntegerLength[ upto]]}]]; altparQ[n_]:= Module[{n2=n^2},MemberQ[Partition[ tfs,IntegerLength[n2],1], EvenQ/@IntegerDigits[n2]]]; Join[{0},Select[Range[upto],altparQ]] (* Harvey P. Dale, May 12 2011 *)

A030154 Squares such that in n and sqrt(n) the parity of digits alternates.

Original entry on oeis.org

0, 1, 4, 9, 16, 25, 36, 49, 81, 256, 529, 729, 1296, 4761, 5476, 6561, 9216, 16129, 32761, 34969, 87616, 763876, 5414929, 5612161, 7414729, 7436529, 7634169, 14561856, 21058921, 34503876, 43072969, 43414921, 45252529, 69272329
Offset: 1

Views

Author

Keywords

Comments

The more digits there are in n, the lower the likelihood that the parity of n's digits will strictly alternate. Thus, the terms of the sequence become increasingly rare as n gets larger. - Harvey P. Dale, Aug 05 2018
For n > 3 the last digit of a(n) isn't 0 or 4. - David A. Corneth, Aug 05 2018

Crossrefs

Programs

  • Mathematica
    pdaQ[n_]:=Module[{a=Mod[IntegerDigits[n],2],b=Mod[IntegerDigits[ Sqrt[ n]],2]},Length[ Split[a]] ==IntegerLength[n]&&Length[Split[b]]== IntegerLength[ Sqrt[n]]]; Join[{0},Select[Range[8500]^2,pdaQ]] (* Harvey P. Dale, Aug 05 2018 *)
  • PARI
    alternating(n)={my(v=digits(n)%2);0==#select(i->v[i]==v[i-1],[2..#v])}
    { for(n=0, 10^5, if(alternating(n^2) && alternating(n), print1(n^2, ", "))) } \\ Andrew Howroyd, Aug 05 2018
    
  • PARI
    \\ for larger n: requires alternating function above
    upto(n)={local(R=List([0])); my(recurse(s,b)=if(b0&&alternating(k^2\b), listput(R, k)); self()(k, 10*b)))))); recurse(0,1); listsort(R); Vec(R)}
    apply(n->n^2, upto(sqrtint(10^12))) \\ Andrew Howroyd, Aug 05 2018

Extensions

Offset changed by David A. Corneth, Aug 05 2018
Showing 1-3 of 3 results.