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.

A348558 Primes where every other digit is 1 starting with the rightmost digit, and no other digit is 1.

Original entry on oeis.org

31, 41, 61, 71, 101, 131, 151, 181, 191, 2131, 2141, 2161, 3121, 3181, 3191, 5101, 5171, 6101, 6121, 6131, 6151, 7121, 7151, 8101, 8161, 8171, 8191, 9151, 9161, 9181, 10141, 10151, 10181, 12101, 12161, 13121, 13151, 13171, 15101, 15121, 15131, 15161, 16141
Offset: 1

Views

Author

Lars Blomberg, Oct 22 2021

Keywords

Crossrefs

Programs

  • Magma
    f1:=func;  fc:=func; [p:p in PrimesUpTo(17000)|f1(p) and fc(p)]; // Marius A. Burtea, Oct 22 2021
  • Mathematica
    Select[Prime@Range@10000,(n=#;s={EvenQ,OddQ};t=Take[IntegerDigits@n,{#}]&/@Select[Range@i,#]&/@If[EvenQ[i=IntegerLength@n],s,Reverse@s];Union@Flatten@First@t=={1}&&FreeQ[Flatten@Last@t,1])&] (* Giorgos Kalogeropoulos, Oct 22 2021 *)
    eod1Q[p_]:=Module[{r=Reverse[IntegerDigits[p]]},Union[Take[r,{1,-1,2}]]=={1}&&FreeQ[ Take[ r,{2,-1,2}],1]]; Select[Prime[Range[2000]],eod1Q] (* Harvey P. Dale, May 28 2023 *)
  • Python
    from sympy import primerange as primes
    def ok(p):
        s = str(p)
        if not all(s[i] == '1' for i in range(-1, -len(s)-1, -2)): return False
        return all(s[i] != '1' for i in range(-2, -len(s)-1, -2))
    print(list(filter(ok, primes(1, 16142)))) # Michael S. Branicky, Oct 22 2021
    
  • Python
    # faster version for generating large initial segments of sequence
    from sympy import isprime
    from itertools import product
    def eo1(maxdigits): # generator for every other digit is 1, no other 1's
        yield 1
        for d in range(2, maxdigits+1):
            if d%2 == 0:
                for f in "23456789":
                    f1 = f + "1"
                    for p in product("023456789", repeat=(d-1)//2):
                        yield int(f1 + "".join(p[i]+"1" for i in range(len(p))))
            else:
                for p in product("023456789", repeat=(d-1)//2):
                    yield int("1" + "".join(p[i]+"1" for i in range(len(p))))
    print(list(filter(isprime, eo1(5)))) # Michael S. Branicky, Oct 22 2021
    

A348559 Primes where every other digit is 3 starting with the rightmost digit, and no other digit is 3.

Original entry on oeis.org

3, 13, 23, 43, 53, 73, 83, 313, 353, 373, 383, 1303, 1373, 2383, 2393, 4363, 4373, 5303, 5323, 5393, 6323, 6343, 6353, 6373, 7393, 8353, 8363, 9323, 9343, 30313, 30323, 31393, 32303, 32323, 32353, 32363, 34303, 34313, 35323, 35353, 35363, 35393, 36313, 36343
Offset: 1

Views

Author

Lars Blomberg, Oct 22 2021

Keywords

Crossrefs

Programs

  • Magma
    f3:=func;  fc:=func; [p:p in PrimesUpTo(40000)|f3(p) and fc(p)]; // Marius A. Burtea, Oct 22 2021
    
  • Mathematica
    Select[Prime@Range@10000,(n=#;s={EvenQ,OddQ};t=Take[IntegerDigits@n,{#}]&/@Select[Range@i,#]&/@If[EvenQ[i=IntegerLength@n],s,Reverse@s];Union@Flatten@First@t=={3}&&FreeQ[Flatten@Last@t,3])&] (* Giorgos Kalogeropoulos, Oct 22 2021 *)
  • Python
    from sympy import primerange as primes
    def ok(p):
        s = str(p)
        if not all(s[i] == '3' for i in range(-1, -len(s)-1, -2)): return False
        return all(s[i] != '3' for i in range(-2, -len(s)-1, -2))
    print(list(filter(ok, primes(1, 36344)))) # Michael S. Branicky, Oct 22 2021
    
  • Python
    # faster version for generating large initial segments of sequence
    from sympy import isprime
    from itertools import product
    def eo3(maxdigits): # generator for every other digit is 3, no other 3's
        yield 3
        for d in range(2, maxdigits+1):
            if d%2 == 0:
                for f in "12456789":
                    f3 = f + "3"
                    for p in product("012456789", repeat=(d-1)//2):
                        yield int(f3 + "".join(p[i]+"3" for i in range(len(p))))
            else:
                for p in product("012456789", repeat=(d-1)//2):
                    yield int("3" + "".join(p[i]+"3" for i in range(len(p))))
    print(list(filter(isprime, eo3(5)))) # Michael S. Branicky, Oct 22 2021

A348560 Primes where every other digit is 7 starting with the rightmost digit, and no other digit is 7.

Original entry on oeis.org

7, 17, 37, 47, 67, 97, 727, 757, 787, 797, 1747, 1787, 2707, 2767, 2797, 3727, 3767, 3797, 4787, 5717, 5737, 6737, 8707, 8737, 8747, 9767, 9787, 70717, 71707, 72707, 72727, 72767, 72797, 73727, 73757, 74707, 74717, 74747, 74797, 75707, 75767, 75787, 75797
Offset: 1

Views

Author

Lars Blomberg, Oct 22 2021

Keywords

Crossrefs

Programs

  • Magma
    f7:=func;  fc:=func; [p:p in PrimesUpTo(80000)|f7(p) and fc(p)]; // Marius A. Burtea, Oct 22 2021
    
  • Mathematica
    Select[Prime@Range@10000,(n=#;s={EvenQ,OddQ};t=Take[IntegerDigits@n,{#}]&/@Select[Range@i,#]&/@If[EvenQ[i=IntegerLength@n],s,Reverse@s];Union@Flatten@First@t=={7}&&FreeQ[Flatten@Last@t,7])&] (* Giorgos Kalogeropoulos, Oct 22 2021 *)
  • Python
    from sympy import primerange as primes
    def ok(p):
        s = str(p)
        if not all(s[i] == '7' for i in range(-1, -len(s)-1, -2)): return False
        return all(s[i] != '7' for i in range(-2, -len(s)-1, -2))
    print(list(filter(ok, primes(1, 75798)))) # Michael S. Branicky, Oct 22 2021
    
  • Python
    # faster version for generating large initial segments of sequence
    from sympy import isprime
    from itertools import product
    def eo7(maxdigits): # generator for every other digit is 7, no other 7's
        yield 7
        for d in range(2, maxdigits+1):
            if d%2 == 0:
                for f in "12345689":
                    f7 = f + "7"
                    for p in product("012345689", repeat=(d-1)//2):
                        yield int(f7 + "".join(p[i]+"7" for i in range(len(p))))
            else:
                for p in product("012345689", repeat=(d-1)//2):
                    yield int("7" + "".join(p[i]+"7" for i in range(len(p))))
    print(list(filter(isprime, eo7(5)))) # Michael S. Branicky, Oct 22 2021
Showing 1-3 of 3 results.