Skip to main content

Questions tagged [function]

For challenges that ask for a function or involve functions in some way. (Also known as methods or subroutines.)

13 votes
16 answers
893 views

In the fewest bytes, in any language, write a function, zigzagdefect(n, d) that takes as input integers n and d < n. The function should return a list of length ...
Jack's user avatar
  • 231
5 votes
3 answers
529 views

Background In Python, function arguments are defined within the parentheses following the function name in the function definition. There are different ways to present function arguments, and they can ...
Mardoxx's user avatar
  • 181
27 votes
12 answers
1k views

Write a program or function (hereafter "function") that returns or prints the source code of four new functions: Increment, decrement, undo, and peek. The initial function contains an ...
Jordan's user avatar
  • 11.9k
19 votes
62 answers
5k views

I honestly can't believe this challenge does not already exist. The challenge Write a function. The specifics Your program must define some sort of callable function. This includes anything ...
moltarze's user avatar
  • 2,578
12 votes
22 answers
2k views

In this challenge you will be determining how controversial a vote is, given an array of other votes, by figuring out a number called the C-factor. What is the C-factor, you ask? Well, imagine you've ...
moltarze's user avatar
  • 2,578
16 votes
14 answers
2k views

Consider you have a hash function \$\mathcal{H}\$ which takes strings of length \$2n\$ and returns strings of length \$n\$ and has the nice property that it is collision resistant, i.e. it is hard to ...
Laikoni's user avatar
  • 26.4k
-1 votes
1 answer
200 views

write a function to tell if a number is symmetric or not. for example: input: 151 output: True input: 142 output: False and so on: 1111 True, 2390 False, 1226221 True
AndiChin's user avatar
  • 335
33 votes
15 answers
4k views

Write a program or function that can distinguish the following 12 trigonometric functions: sin, cos, ...
Laikoni's user avatar
  • 26.4k
-3 votes
2 answers
1k views

The task is simple: Create an if-statement from scratch in x86 assembly that runs in as few clock-cycles as possible. Must be x86 assembly. Can't use any of the conditional jump/branch instructions (e....
Lance Pollard's user avatar
19 votes
10 answers
2k views

Left and right Riemann sums are approximations to definite integrals. Of course, in mathematics we need to be very accurate, so we aim to calculate them with a number of subdivisions that approaches ...
Mr. Xcoder's user avatar
  • 42.9k
21 votes
7 answers
2k views

A half-exponential function is one which when composed with itself gives an exponential function. For instance, if f(f(x)) = 2^x, then ...
izzyg's user avatar
  • 42.3k
13 votes
3 answers
537 views

Today, we'll be computing the most efficient binary function. More specifically, we'll be computing the function which, when an expression is created from applying the function to the constant input 0 ...
izzyg's user avatar
  • 42.3k
10 votes
2 answers
604 views

Being a Haskell hacker, I prefer pointfree notation over pointful. Unfortunately some people find pointfree notation hard to read, and I find it hard to get the correct number of parentheses when I ...
BlackCap's user avatar
  • 3,958
15 votes
5 answers
283 views

Many important topics in abstract algebra involve a binary function acting on a set. A number of properties of such functions have been defined in the investigation of such topics. Your challenge will ...
izzyg's user avatar
  • 42.3k
2 votes
4 answers
852 views

Your Goal: Estimate pi to at least 10 decimal places. The format is your choice - it can output as a number, as a string, as an output to STDOUT, etc. Seems easy, right? But wait, it's not as simple ...
Glen O's user avatar
  • 2,976

15 30 50 per page