Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

0 votes

Is this number a prime?

AWK, 32 bytes {for(j=2;$0%j++;);print j~i?1:0} Try it online!
C K's user avatar
  • 81
0 votes

Crazy Librarian's Arithmetic Sequence of Primes

Vyxal, 25 bytes ₀+æ[λS₅ʀ?vṀ⌊JæA;₁ȯ|`∵Ǒ ƛ£ Try it Online! (first 5) ...
emanresu A's user avatar
  • 38.5k
1 vote

List of primes under a million

AWK, 58 bytes {for(;i++<$0;){for(j=x=1;j<i;)i%++j?J:x++;if(2~x)print i}} Try it online! Will work for arbitrary amount: ...
C K's user avatar
  • 81
0 votes

Primes with prime bit-counts

PARI/GP, 64 bytes n->p=isprime;[i|i<-[1..n],p(i)*p(t=vecsum(b=binary(i)))*p(#b-t)] Attempt This Online!
alephalpha's user avatar
  • 48.2k
0 votes

Primes with prime bit-counts

PARI/GP, 140 bytes 140 bytes, it can be golfed more. Golfed version. Attempt This Online! ...
138 Aspen's user avatar
  • 5,951
1 vote

Primes with prime bit-counts

Pyt, 17 bytes řĐṗ*žĐĐĦṗ⇹˜⁻Ħṗ**ž Try it online! ...
Kip the Malamute's user avatar
1 vote

Piecing Paired Primes

Pyt, 7 bytes ⁺řᵽᵮʁ/Ʃ Try it online! ...
Kip the Malamute's user avatar
0 votes

Can even numbers become prime?

Pyt, 15 bytes 2⇹ŘĐĐ⁻Ḷ⁺Ɩᴇ*+⁻ṗƩ Try it online! ...
Kip the Malamute's user avatar
1 vote

Is it a Mersenne Prime?

Pari/GP, 29 bytes A port of @lirtosiast's Mathematica answer in Pari/GP. Golfed version. Try it online! g(n)=isprime(bitand(n,n+2)*n)
138 Aspen's user avatar
  • 5,951
0 votes

Is it a Mersenne Prime?

05AB1E, 5 bytes bWIp* Try it online! Explanation b: push binary version of (implicit) input ...
Flummox's user avatar
  • 69
0 votes

Is it a Mersenne Prime?

Pyt, 8 bytes Đṗ⇹ɓąƖΠ* Try it online! ...
Kip the Malamute's user avatar

Top 50 recent answers are included