login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A059168 Primes in which digits alternately rise and fall (or vice versa); sometimes called undulating primes. 10
2, 3, 5, 7, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 131, 151, 163, 173, 181, 191, 193, 197, 241, 251, 263, 271, 281, 283, 293, 307, 313, 317, 353, 373, 383, 397, 401, 409, 419, 439, 461, 463, 487, 491 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
REFERENCES
C. A. Pickover, "Wonders of Numbers", Oxford New York 2001, Chapter 52, pp. 123-124, 316-317.
LINKS
C. A. Pickover, "Wonders of Numbers, Adventures in Mathematics, Mind and Meaning," Zentralblatt review
MAPLE
extend:= proc(n) local L, j;
L:= convert(n, base, 10);
if (L[-1] < L[-2]) xor (nops(L)::odd) then
seq(10*n+j, j=0..L[1]-1)
else
seq(10*n+j, j=L[1]+1..9)
fi
end proc:
und[2]:= [seq(seq(10*i+j, j=subs(i=NULL, [$0..9])), i=1..9)]:
for i from 3 to 4 do und[i]:= map(extend, und[i-1]) od:
select(isprime, [2, 3, 5, 7, seq(op(und[i], i=2..4)]); # Robert Israel, Nov 15 2018
MATHEMATICA
d[n_]:=Differences[IntegerDigits[n]]; mQ[n_]:=MemberQ[d[n], 0]==False; a[n_]:=DeleteDuplicates[Sign[Take[d[n], {1, -1, 2}]]]; b[n_]:=DeleteDuplicates[Sign[Take[d[n], {2, -1, 2}]]]; t={}; Do[p=Prime[n]; If[mQ[p], If[Length[IntegerDigits[p]]<=2, AppendTo[t, p], If[Length[a[p]]==Length[b[p]]==1 && a[p][[1]]!=b[p][[1]], AppendTo[t, p]]]], {n, 95}]; t (* Jayanta Basu, May 08 2013 *)
Table[Which[p<10, p, p<100&&Differences[IntegerDigits[p]]!={0}, p, p>100&&Union[Total/@ Partition[Sign[Differences[IntegerDigits[p]]], 2, 1]]=={0}, p, True, Nothing], {p, Prime[ Range[ 150]]}] (* Harvey P. Dale, Aug 07 2023 *)
PROG
(Python)
from sympy import isprime
def f(w, dir):
if dir == 1:
for s in w:
for t in range(int(s[-1])+1, 10):
yield s+str(t)
else:
for s in w:
for t in range(0, int(s[-1])):
yield s+str(t)
A059168_list = []
for l in range(5):
for d in '123456789':
x = d
for i in range(1, l+1):
x = f(x, (-1)**i)
A059168_list.extend([int(p) for p in x if isprime(int(p))])
if l > 0:
y = d
for i in range(1, l+1):
y = f(y, (-1)**(i+1))
A059168_list.extend([int(p) for p in y if isprime(int(p))]) # Chai Wah Wu, Apr 25 2021
CROSSREFS
Sequence in context: A243535 A308078 A050757 * A032758 A106118 A029743
KEYWORD
nonn,base,easy
AUTHOR
N. J. A. Sloane, Feb 14 2001
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), Feb 15 2001
Offset changed by Robert Israel, Nov 15 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 07:38 EDT 2024. Contains 371782 sequences. (Running on oeis4.)