Hey chad, user can't generate an array of elements with powers of 2 less than N in one line of code

>Hey chad, user can't generate an array of elements with powers of 2 less than N in one line of code
>No fucking way stacey. What a fucking loser lmao

x = [ i for i in range(1, 100) if i ** 2 < 1024 ]

You understand how poorly you've solved the problem, right?
x = [i ** 2 for i in range(1, 8)]

But what if I want squares no higher than 5600? Do the math or just write it down?

[i for i in range(1, 100) if i ** 2 < 5600]

>powers of two
>takes square

Is there no log2() function you can use?
x = [I for i in range(1, log2(5600))]

>one line of code
haha so funny

>elements WITH powers of two

just shift unsigned bits left instead of using boolean or multiplcation which eats up memory

You don't need one.
max(i for i range(64) in if n >> i)

...

you've gotta be baiting me
l n = [1 .. truncate (n ** 0.5) - 1]
l 1024


says the one who can't go past 10000

JavaScript:
[for (i of Array(100).keys()) if (Math.pow(i, 2) < 1024) i];

>i for i in range(1, 100)

wat do

100 arrays of 100?

var x = Enumerable.Range(1, 100).Select(t => Math.Pow(t, 2)).ToArray();

What is the question? That generates each element in range(1,100).

you guys are fucking adorable sometimes

list(range(1, sqrt(1024)))

Sup Forums is dead

It's probably a bait, but this kind of inefficient shit is exactly what I'd expect from your average Python user.

int[] array = IntStream.range(0, (int) (Math.log(n)/Math.log(2))).map(i -> 1

I sometimes don't generally understand you guys. What drives you to even find this a challenge or "useful" when you have never actually used it in any job case.

Except when compiled that's multiple lines of code

int*uslesspieceofcode(void){int ii=0x01;int*result=malloc(sizeof(int)*8*sizeof(int));int*ptr=result;printf("bitch, ");while(ii>0){*ptr++=ii;ii=ii

a=Array.apply(null, new Array(100)).map(Number.call, Number).map(a=>Math.pow(a,2)a)

Compiler fixes that shit anyway

My apologies, didn't notice the less than N requirement.
int*evenmoreuselesspieceofcode(int N){int ii=0x01;int jj=0;printf("bitch, ");while((ii>0)&&(ii

nah dude he's proud of himself.
these are the types of questions you're given on tests at school and in interviews.
ever heard of fizzbuzz? this is fizzbuzz.

> let f = uncurry takeWhile . first (flip (.) (^2) . (flip ( f 1024
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]
>

Why is one of the "girls" named Chad? Are we in Thailand all of a sudden?

a=Array(100).fill().map((z,a)=>a*aa)

> let f = flip takeWhile [1..] . flip (.) (^2) . flip (

>uncurry

Javascript:
var N = 1024;
var x = Array.apply(null, Array(100)).map(function (_, i) {if (Math.pow(i,2) < N) return i;});
console.log(x);

That didn't work for me.

Why is White 3DPD so unappealing?

First semester CS kid thinks doing everything in one line is optimal. Saged

Why the fuck all are you retards using some shitty pow function? Just use fucking bitshift and the abs of log to determine the size of the array

T-the one on the left is kinda cute.