Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Question

Commonmark migration
Source Link

###Introduction

Introduction

In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.

You can see that the first appearence of 15 starts at the 20th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 15 = position 20

The first appearence of 45 starts at the 4th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^ 
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 45 = position 4

So, the task is easy. Given a non-negative integer, output the position of the integer in the Champernowne constant.

###Rules

Rules

  • You may provide a function or a program
  • This is , so the submission with the least amount of bytes wins!

###Test cases

Test cases

Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48

###Introduction

In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.

You can see that the first appearence of 15 starts at the 20th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 15 = position 20

The first appearence of 45 starts at the 4th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^ 
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 45 = position 4

So, the task is easy. Given a non-negative integer, output the position of the integer in the Champernowne constant.

###Rules

  • You may provide a function or a program
  • This is , so the submission with the least amount of bytes wins!

###Test cases

Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48

Introduction

In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.

You can see that the first appearence of 15 starts at the 20th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 15 = position 20

The first appearence of 45 starts at the 4th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^ 
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 45 = position 4

So, the task is easy. Given a non-negative integer, output the position of the integer in the Champernowne constant.

Rules

  • You may provide a function or a program
  • This is , so the submission with the least amount of bytes wins!

Test cases

Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48
added 12 characters in body
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248

###Introduction

In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.

You can see that the first appearence of 15 starts at the 20th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 15 = position 20

The first appearence of 45 starts at the 4th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^ 
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 45 = position 4

So, the task is easy. Given ana non-negative integer, output the position of the integer in the Champernowne constant.

###Rules

  • You may provide a function or a program
  • Assume that the integer is always non-negative
  • This is , so the submission with the least amount of bytes wins!

###Test cases

Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48

###Introduction

In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.

You can see that the first appearence of 15 starts at the 20th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 15 = position 20

The first appearence of 45 starts at the 4th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^ 
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 45 = position 4

So, the task is easy. Given an integer, output the position of the integer in the Champernowne constant.

###Rules

  • You may provide a function or a program
  • Assume that the integer is always non-negative
  • This is , so the submission with the least amount of bytes wins!

###Test cases

Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48

###Introduction

In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.

You can see that the first appearence of 15 starts at the 20th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 15 = position 20

The first appearence of 45 starts at the 4th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^ 
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 45 = position 4

So, the task is easy. Given a non-negative integer, output the position of the integer in the Champernowne constant.

###Rules

  • You may provide a function or a program
  • This is , so the submission with the least amount of bytes wins!

###Test cases

Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48
Source Link
Adnan
  • 44.7k
  • 6
  • 83
  • 248

Find the number in the Champernowne constant

###Introduction

In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.

You can see that the first appearence of 15 starts at the 20th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 15 = position 20

The first appearence of 45 starts at the 4th decimal:

 Position
 0000000001111111111222222222233333333334444444444555555555566666666
 1234567890123456789012345678901234567890123456789012345678901234567
 ^ 
0.1234567891011121314151617181920212223242526272829303132333435363738...
 ^^
 45 = position 4

So, the task is easy. Given an integer, output the position of the integer in the Champernowne constant.

###Rules

  • You may provide a function or a program
  • Assume that the integer is always non-negative
  • This is , so the submission with the least amount of bytes wins!

###Test cases

Input: 20
Output: 30
Input: 333
Output: 56
Input: 0
Output: 11 (note that the 0 before the decimal point is ignored)
Input: 2930
Output: 48

AltStyle によって変換されたページ (->オリジナル) /