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-1 of 1 results.

A068881 Largest n-digit square with property that digits alternate in parity, or 0 if no such number exists.

Original entry on oeis.org

9, 81, 961, 9216, 96721, 929296, 9690769, 98525476, 987656329, 9618509476, 98987632129, 987650365636, 9890943230169, 98987854141696, 987896383010761, 9896907878105616, 98989096389856929, 989894587654967296, 9898969096969272961, 98985494707696721476
Offset: 1

Views

Author

Amarnath Murthy, Mar 19 2002

Keywords

Examples

			a(4) = 9216 as 9, 2, 1, 6 have alternating parity.
		

Crossrefs

Programs

  • Maple
    alp:= proc(n) local L,d;
    L:= convert(n,base,10);
    d:= nops(L);
    if d::even then L:= L + map(op, [[0,1]$(d/2)]) else L:= L + map(op, [[0,1]$((d-1)/2),[0]]) fi;
    nops(convert(L mod 2, set))=1
    end proc:f:= proc(d) local s;
      for s from floor(sqrt(10^d)) by -1 to ceil(sqrt(10^(d-1))) do
        if alp(s^2) then return s^2 fi
      od;
      0
    end proc:map(f, [$1..10]); # Robert Israel, Aug 14 2018
  • Mathematica
    altQ[n_] := n < 10 || Union[Total /@ Partition[ Mod[ IntegerDigits@ n, 2], 2, 1]] == {1}; a[n_] := Block[{r = Floor@ Sqrt@ FromDigits[8 + Mod[ Range@ n, 2]]}, While[! altQ[r^2], r--]; r^2]; Array[a, 16] (* Giovanni Resta, Aug 17 2018 *)

Extensions

a(5) corrected and more terms from Robert Israel, Aug 14 2018
a(18)-a(20) from Giovanni Resta, Aug 16 2018
Showing 1-1 of 1 results.