Comments (6)
121 bytes
for i in range(51):
x=sum([int(i) for i in str(bin(i)[2:])])
flag=0
if x in {2,3,5,7}:
print(i)
from fh-250-puzzles.
for i in range(51):
s = sum(map(int,"{0:b}".format(i)))
if (all(False for i in range(2,s) if s % i == 0) and not s < 2):
print(s)
63 bytes
from fh-250-puzzles.
def isprime(n):
return (all(False for i in range(2,n) if n % i == 0) and not n < 2)
for i in range(51):
if isprime(sum(map(int,bin(i)[2:]))):
print(i+1)
from fh-250-puzzles.
def p(n): return (all(False for i in range(2,n) if n%i == 0) and not n<2)
i,c = 1,0
while c<25:
if (p(bin(i).count('1'))):
print(i, end=' ')
c+=1
i+=1
196 bytes
from fh-250-puzzles.
#include <stdio.h>
typedef unsigned uint;uint is_pern(uint n){uint c = 2693408940u;while (n) c >>= 1, n &= (n - 1);return c & 1;}int main(){uint i, c;for (i = c = 0; c < 25; i++)if (is_pern(i))printf("%u ", i), ++c;}
The size is 217 bytes.
from fh-250-puzzles.
is_prime = lambda n: all(n % i != 0 for i in range(2, n)) and n > 1
cnt = sum(is_prime(sum(map(int, bin(i)[2:]))) for i in range(51))
from fh-250-puzzles.
Related Issues (5)
- Obfuscated C HOT 4
- Code Golf: Missing Digit HOT 3
- Code Golf: Collatz HOT 4
- Figure it out HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fh-250-puzzles.