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.

Previous Showing 11-18 of 18 results.

A343591 Smoothly undulating alternating primes.

Original entry on oeis.org

2, 3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 181, 383, 727, 787, 929, 18181, 32323, 72727, 74747, 78787, 94949, 1212121, 1616161, 323232323, 383838383, 727272727, 929292929, 989898989, 12121212121, 14141414141, 32323232323, 383838383838383, 38383838383838383, 72727272727272727
Offset: 1

Views

Author

Bernard Schott, Apr 21 2021

Keywords

Comments

Equivalently, numbers that are primes, smoothly undulating = in which the digits alternate: ababab... with a <> b (A032758) and alternating = in which parity of the digits alternates (A030144).
Charles W. Trigg was the first to use the word 'smoothly' for these integers.
If we note a(ba) the terms where the substring (ba) is repeated in their decimal expansion, there exist only 16 possibilities with a odd <> 5 and b even <> 0 to get such primes. Indeed, there exist primes of the form 1(21), 1(41), 1(61), 1(81), 3(23), 3(83), 7(27), 7(47), 7(87), 9(29), 9(49), 9(89). There do not exist terms of the form 3(63), 7(67), 9(69), as they are always composite.
Now, what about possible terms of the form 3(43)? If (43) is repeated 3k times, 3(43) is divisible by 3; if (43) is repeated 3k+1 times, 3(43) is divisible by 7; so if such a prime exists, then the substring (43) must be repeated 3k+2 times, but it is not known if such smoothly undulating prime 3(43) exists and if it exists, (43) must be repeated at least 9302 times, so k >= 3100 (link).
Some properties:
-> Every term has two digits or an odd number of digits.
-> All terms with an odd number of digits are palindromic (A059758).
-> Only 2 and the nine 2-digit terms begin with an even digit.

Examples

			1616161 is a term as it is prime and the digits 1 and 6 have odd and even parity and alternate.
		

References

  • Charles W. Trigg, Special Palindromic Primes, Journal of Recreational Mathematics, 4 (July 1971) 169-170.

Crossrefs

Intersection of A030144 and A032758.
Subsequence of A343590.

Programs

  • Maple
    f:= proc(n) local i,a,b,c,d;
      c:= add(10^i,i=1..n-1,2);
      d:= add(10^i,i=0..n-1,2);
      if n = 2 then op(select(isprime,[seq(seq(a*c+b*d, b=[1,3,7,9]),a=[2,4,6,8])]))
        else op(select(isprime, [seq(seq(a*c+b*d, a=[0,2,4,6,8]),b=[1,3,7,9])]))
      fi
    end proc:
    f(1):= (2,3,5,7):
    map(f, [1,2,seq(i,i=3..17,2)]); # Robert Israel, Nov 09 2023
  • Mathematica
    f[o_,e_,n_,m_] := FromDigits @ Riffle[ConstantArray[o,n], ConstantArray[e,n-m]]; seq[n_,m_] := Module[{o = Range[1,9,2], e = Range[0,8,2]}, Select[Union[f @@@ Join[Tuples[{o, e, {n}, {m}}], Tuples[{Rest @ e, o, {n}, {m}}]]], PrimeQ]]; s = seq[1, 1]; Do[s = Join[s, seq[m, Boole[m > 1]]], {m, 1, 10}]; s (* Amiram Eldar, Apr 21 2021 *)
  • Python
    from sympy import isprime
    def agenthru(maxdigits):
      if maxdigits >= 1: yield from [2, 3, 5, 7]
      for digits in [2]*(maxdigits >= 2) + list(range(3, maxdigits+1, 2)):
        hlf, odd = (digits+1)//2, digits%2
        d1range = "1379" if digits%2 == 1 else "123456789"
        d2range = "1379" if digits%2 == 0 else "0123456789"
        for d1 in d1range:
          for d2 in d2range:
            if int(d1)%2 == int(d2)%2: continue
            t = int("".join([*sum(zip(d1*hlf, d2*(digits-hlf)), ())]+[d1*odd]))
            if isprime(t): yield t
    print([p for p in agenthru(17)]) # Michael S. Branicky, Apr 21 2021

A068887 Primes with property that digits alternate in parity individually as well as in concatenation with previous terms.

Original entry on oeis.org

2, 3, 23, 29, 41, 43, 47, 61, 67, 83, 89, 2129, 2141, 2143, 2161, 2309, 2341, 2347, 2381, 2383, 2389, 2503, 2521, 2543, 2549, 2707, 2729, 2741, 2749, 2767, 2789, 2903, 2909, 2927, 2963, 2969, 4127, 4129, 4327, 4349
Offset: 1

Views

Author

Amarnath Murthy, Mar 20 2002

Keywords

Crossrefs

Cf. A030144.

Programs

  • Mathematica
    d[n_]:=IntegerDigits[n]; aQ[n_]:=Union[Abs[Differences[Boole@EvenQ[d[n]]]]]=={1}; t={2,3}; Do[p=Prime[i]; x=FromDigits[Flatten[{d[Last[t]],d[p]}]]; If[aQ[p] && aQ[x],AppendTo[t,p]],{i,5,600}]; t (* Jayanta Basu, May 23 2013 *)

A225659 Primes p where p + sumOfDigits(p) +- 3 is prime.

Original entry on oeis.org

2, 3, 5, 7, 23, 29, 41, 43, 47, 61, 67, 83, 89, 131, 137, 139, 157, 173, 179, 191, 197, 223, 227, 229, 241, 263, 269, 283, 311, 313, 317, 337, 353, 359, 373, 379, 397, 401, 409, 421, 443, 449, 463, 467, 487, 557
Offset: 1

Views

Author

John-Å. W. Olsen, May 11 2013

Keywords

Comments

a(n) = A068690(n), A030144(n), A069556(n), A091727(n), A156756(n) if n<14.

Examples

			If p = 409, then 409 + sod(409) +- 3 = 409+13 - 3 = 419, which is prime.
If p =  23, then  23 + sod(23)  +- 3 = 23+5   + 3 = 31,  which is prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[102]],Or@@PrimeQ[#+Total[IntegerDigits[#]]+{3,-3}] &] (* Jayanta Basu, May 23 2013 *)
  • PARI
    ok(p)= {my(s=vecsum(digits(p)));isprime(p) && (isprime(p+s-3) || isprime(p+s+3))}
    select(ok,[1..1000]) \\ Andrew Howroyd, Feb 22 2018

A226016 Primes with alternate digits even and odd, and most significant digit even.

Original entry on oeis.org

2, 23, 29, 41, 43, 47, 61, 67, 83, 89, 2129, 2141, 2143, 2161, 2309, 2341, 2347, 2381, 2383, 2389, 2503, 2521, 2543, 2549, 2707, 2729, 2741, 2749, 2767, 2789, 2903, 2909, 2927, 2963, 2969, 4127, 4129, 4327, 4349, 4363, 4507, 4523, 4547, 4549, 4561, 4567, 4583
Offset: 1

Views

Author

Jayanta Basu, May 22 2013

Keywords

Comments

The only difference compared to A068887 is that the 3 is missing here. - R. J. Mathar, May 26 2013

Examples

			2143 is a member since its digits are alternatively even and odd.
		

Crossrefs

Programs

  • Mathematica
    a[n_,k_]:=Union[Boole/@EvenQ[Take[IntegerDigits[n],{k,-1,2}]]]; Join[{2},Select[Prime[Range[5,620]],{a[#,1],a[#,2]}=={{1},{0}} &]]
    Select[Prime[Range[1000]],Boole[EvenQ[IntegerDigits[#]]]==PadRight[{},IntegerLength[#],{1,0}]&] (* Harvey P. Dale, Oct 28 2023 *)

A343676 Number of n-digit undulating alternating primes.

Original entry on oeis.org

4, 9, 23, 49, 175, 321, 1189, 3025, 12111, 28492, 113409, 251513, 1068440, 2629980, 11690210, 28498852, 128871588, 298890814, 1309837146
Offset: 1

Views

Author

Chai Wah Wu, Apr 25 2021

Keywords

Comments

a(n) is the number of n-digit terms in A343590.
a(n) <= A057333(n).

Crossrefs

Programs

  • Python
    def f(w):
        for s in w:
            for t in range(int(s[-1])+1,10,2):
                yield s+str(t)
    def g(w):
        for s in w:
            for t in range(1-int(s[-1])%2,int(s[-1]),2):
                yield s+str(t)
    def A343676(n):
        c = 0
        for d in '123456789':
            x = d
            for i in range(1,n):
                x = g(x) if i % 2 else f(x)
            c += sum(1 for p in x if isprime(int(p)))
            if n > 1:
                y = d
                for i in range(1,n):
                    y = f(y) if i % 2 else g(y)
                c += sum(1 for p in y if isprime(int(p)))
        return c

Extensions

a(18)-a(19) from Martin Ehrenstein, Apr 27 2021

A343677 Number of (2n+1)-digit undulating alternating palindromic primes.

Original entry on oeis.org

4, 6, 19, 34, 100, 241, 697, 1779, 6590, 16585, 57237, 179291, 591325, 1707010, 6520756, 18271423, 65212230, 210339179, 706823539
Offset: 0

Views

Author

Chai Wah Wu, Apr 25 2021

Keywords

Comments

a(n) is the number of (2n+1)-digit terms in A343675.
a(n) <= A057332(n).

Crossrefs

Programs

  • Python
    from sympy import isprime
    def f(w):
        for s in w:
            for t in range(int(s[-1])+1,10,2):
                yield s+str(t)
    def g(w):
        for s in w:
            for t in range(1-int(s[-1])%2,int(s[-1]),2):
                yield s+str(t)
    def A343677(n):
        if n == 0:
            return 4
        c = 0
        for d in '1379':
            x = d
            for i in range(1,n+1):
                x = g(x) if i % 2 else f(x)
            c += sum(1 for p in x if isprime(int(p+p[-2::-1])))
            y = d
            for i in range(1,n+1):
                y = f(y) if i % 2 else g(y)
            c += sum(1 for p in y if isprime(int(p+p[-2::-1])))
        return c

Extensions

a(17)-a(18) from Chai Wah Wu, May 02 2021

A382027 Primes whose decimal digits are in ascending order and also parity alternating.

Original entry on oeis.org

2, 3, 5, 7, 23, 29, 47, 67, 89, 127, 149, 167, 347, 349, 367, 389, 569, 2347, 2389, 2789, 4567, 4789, 12347, 12569, 12589, 34589, 234589, 1234789, 1456789, 23456789
Offset: 1

Views

Author

Alois P. Heinz, Mar 12 2025

Keywords

Crossrefs

Intersection of A030144 and A052015.

Programs

  • Maple
    b:= proc(n) `if`(isprime(n), n, [][]), seq(b(10*n+j), j=irem(n, 10)+1..9, 2) end:
    {seq(b(n), n=1..9)}[];
  • Mathematica
    ad=Select[Prime[Range[2*10^6]],Union[IntegerDigits[#]]==IntegerDigits[#]&];fQ[n_] := Block[{m = Mod[ IntegerDigits@ n, 2]}, m == Split[m, UnsameQ][[1]]];Select[ad,fQ] (* James C. McMahon, Mar 20 2025 *)

A229040 Fibonacci numbers in which parity of the decimal digits alternates.

Original entry on oeis.org

0, 1, 2, 3, 5, 8, 21, 34, 89, 610, 987, 4181, 6765
Offset: 1

Views

Author

Jonathan Vos Post, Sep 12 2013

Keywords

Comments

No more values through F(19000). - R. J. Mathar, Jun 30 2020

Crossrefs

Programs

  • Maple
    isA030141 := proc(n)
        dgs := convert(n,base,10) ;
        for i from 2 to nops(dgs) do
            if modp(op(i,dgs),2) = modp(op(i-1,dgs),2) then
                return false;
            end if;
        end do:
        true ;
    end proc:
    for i from 0 do
        f := combinat[fibonacci](i) ;
        if isA030141(f) then
            print(f) ;
        end if;
    end do: # R. J. Mathar, Mar 13 2015

Formula

A000045 INTERSECTION A030141.
Previous Showing 11-18 of 18 results.