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

A068882 Triangular numbers with property that digits alternate in parity.

Original entry on oeis.org

1, 3, 6, 10, 21, 36, 45, 78, 105, 210, 276, 325, 496, 561, 630, 703, 741, 903, 1830, 2145, 2701, 5050, 6105, 6903, 8385, 9870, 10585, 12561, 14365, 18145, 18721, 23436, 25878, 29890, 30381, 32385, 36585, 38503, 38781, 41616, 47278, 50721
Offset: 1

Views

Author

Amarnath Murthy, Mar 19 2002

Keywords

Examples

			1830 is a term as 1, 8, 3 and 0 have odd and even parity alternately.
		

Crossrefs

Programs

  • Mathematica
    altQ[n_] := n < 10 || Union[ Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; t[n_] := n (n + 1)/2; Select[ t@ Range@ 400, altQ] (* Giovanni Resta, Aug 17 2018 *)

Extensions

More terms from Sascha Kurz, Mar 23 2002

A068877 Largest n-digit prime with property that digits alternate in parity.

Original entry on oeis.org

7, 89, 983, 8969, 98981, 898987, 9898921, 89898983, 989898989, 8989898969, 98989898981, 898989898987, 9898989898901, 89898989898967, 989898989898943, 8989898989898969, 98989898989898981, 898989898989898943, 9898989898989898789
Offset: 1

Views

Author

Amarnath Murthy, Mar 19 2002

Keywords

Examples

			a(4) = 8969 as 8, 9, 6 and 9 have even and odd parity alternately.
		

Crossrefs

Programs

  • Sage
    concat = lambda x: Integer(''.join(map(str,x)),base=10)
    def A068877(n):
        dd = {0:range(0,10,2)[::-1], 1: range(1,10,2)[::-1]}
        for d0 in [1..9][::-1]:
            if n % 2 == 0 and d0 % 2 == 1: continue # optimization
            ds = [dd[(d0+1+i) % 2] for i in range(n-1)]
            for dr in cartesian_product(ds):
                c = concat([d0]+dr)
                if is_prime(c): return c  # [D. S. McNeil, Apr 02 2011]

Extensions

a(15)-a(19) from Donovan Johnson, Apr 01 2011

A068880 Smallest n-digit square with property that digits alternate in parity.

Original entry on oeis.org

1, 16, 121, 1296, 12321, 147456, 1038361, 10929636, 103652761, 1010985616, 10327234129, 101070583056, 1010163694761, 10107210905856, 101030903296569, 1012923810743296, 10101430507492129, 101034169694343076, 1010167692929438121, 10101478149656965696
Offset: 1

Views

Author

Amarnath Murthy, Mar 19 2002

Keywords

Examples

			a(4) = 1296 as 1, 2, 9 and 6 have odd and even parity alternately.
		

Crossrefs

Programs

  • Mathematica
    altQ[n_] := n < 10 || Union[ Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; a[n_] := Block[{r = Ceiling@ Sqrt@ FromDigits[ Mod[Range@ n, 2]]}, While[! altQ[r^2], r++]; r^2]; Array[a, 16] (* Giovanni Resta, Aug 17 2018 *)
  • Python
    from math import isqrt
    from itertools import count, islice
    def allalt(s):
        es, os, e, o = set(s[::2]), set(s[1::2]), set("02468"), set("13579")
        return (es <= o and os <= e) or (es <= e and os <= o)
    def a(n):
        r = isqrt(int(("10"*n)[:n]))
        while len(s:=str(r*r)) < n or not allalt(s): r += 1
        return int(s)
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Mar 21 2024

Extensions

More terms from Sascha Kurz, Mar 23 2002
a(14)-a(20) from Giovanni Resta, Aug 17 2018

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

A068883 Smallest n-digit triangular numbers with property that digits alternate in parity, or 0 if no such number exists.

Original entry on oeis.org

1, 10, 105, 1830, 10585, 107416, 1038961, 10109256, 101410161, 1014503490, 10143650961, 101072103210, 1012143638925, 10101274165450, 101014143472945, 1010363290981278, 10101078125834905, 101012169252147076, 1010125816103490141
Offset: 1

Views

Author

Amarnath Murthy, Mar 19 2002

Keywords

Examples

			a(4) = 1830 is a term as 1, 8, 3 and 0 have odd and even parity alternately.
		

Crossrefs

Extensions

a(7)-a(18) from Donovan Johnson, Mar 14 2010
a(19) from Donovan Johnson, Mar 11 2011

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

Original entry on oeis.org

6, 78, 903, 9870, 96141, 941878, 9850141, 98947278, 985036305, 9892547470, 98585094741, 989436909450, 9898947258903, 98969892923278, 989872901298945, 9898987276765450, 98985850965876105, 989898183850729896, 9898969072503098503
Offset: 1

Views

Author

Amarnath Murthy, Mar 19 2002

Keywords

Examples

			a(4) = 9870 is a term as 9, 8, 7 and 0 have odd and even parity alternately.
		

Crossrefs

Extensions

a(6)-a(19) from Donovan Johnson, Mar 11 2011
Showing 1-6 of 6 results.