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.

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

This page as a plain text file.
%I A348560 #15 Sep 08 2022 08:46:26
%S A348560 7,17,37,47,67,97,727,757,787,797,1747,1787,2707,2767,2797,3727,3767,
%T A348560 3797,4787,5717,5737,6737,8707,8737,8747,9767,9787,70717,71707,72707,
%U A348560 72727,72767,72797,73727,73757,74707,74717,74747,74797,75707,75767,75787,75797
%N A348560 Primes where every other digit is 7 starting with the rightmost digit, and no other digit is 7.
%H A348560 Michael S. Branicky, <a href="/A348560/b348560.txt">Table of n, a(n) for n = 1..10000</a>
%t A348560 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 *)
%o A348560 (Magma) f7:=func<n|forall{i:i in [1..#Intseq(n) by 2]| Intseq(n)[i] eq 7}>;  fc:=func<n|  forall{i:i in [2..#Intseq(n) by 2]| Intseq(n)[i] ne 7}>; [p:p in PrimesUpTo(80000)|f7(p) and fc(p)]; // _Marius A. Burtea_, Oct 22 2021
%o A348560 (Python)
%o A348560 from sympy import primerange as primes
%o A348560 def ok(p):
%o A348560     s = str(p)
%o A348560     if not all(s[i] == '7' for i in range(-1, -len(s)-1, -2)): return False
%o A348560     return all(s[i] != '7' for i in range(-2, -len(s)-1, -2))
%o A348560 print(list(filter(ok, primes(1, 75798)))) # _Michael S. Branicky_, Oct 22 2021
%o A348560 (Python) # faster version for generating large initial segments of sequence
%o A348560 from sympy import isprime
%o A348560 from itertools import product
%o A348560 def eo7(maxdigits): # generator for every other digit is 7, no other 7's
%o A348560     yield 7
%o A348560     for d in range(2, maxdigits+1):
%o A348560         if d%2 == 0:
%o A348560             for f in "12345689":
%o A348560                 f7 = f + "7"
%o A348560                 for p in product("012345689", repeat=(d-1)//2):
%o A348560                     yield int(f7 + "".join(p[i]+"7" for i in range(len(p))))
%o A348560         else:
%o A348560             for p in product("012345689", repeat=(d-1)//2):
%o A348560                 yield int("7" + "".join(p[i]+"7" for i in range(len(p))))
%o A348560 print(list(filter(isprime, eo7(5)))) # _Michael S. Branicky_, Oct 22 2021
%Y A348560 Cf. A000040, A348558, A348559, A348561.
%K A348560 nonn,base
%O A348560 1,1
%A A348560 _Lars Blomberg_, Oct 22 2021