GithubHelp home page GithubHelp logo

Comments (6)

VikramGoyal23 avatar VikramGoyal23 commented on June 13, 2024 1

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.

tanyyyming avatar tanyyyming commented on June 13, 2024
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.

joeng03 avatar joeng03 commented on June 13, 2024
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.

sg-incognito avatar sg-incognito commented on June 13, 2024
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.

joshcangit avatar joshcangit commented on June 13, 2024
#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.

joeng03 avatar joeng03 commented on June 13, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.