{"id":19112372,"url":"https://github.com/mtlh/digits0ton","last_synced_at":"2025-08-20T15:19:50.740Z","repository":{"id":143452167,"uuid":"289884222","full_name":"mtlh/digits0toN","owner":"mtlh","description":"https://edabit.com/challenge/j9zed4GnykS48W6vh My solution to this problem in Python and JavaScript.","archived":false,"fork":false,"pushed_at":"2020-08-24T09:30:40.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-03T04:47:06.744Z","etag":null,"topics":["algorithm","coding-challenge","javascript","python"],"latest_commit_sha":null,"homepage":"https://edabit.com/challenge/j9zed4GnykS48W6vh","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mtlh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-24T09:27:28.000Z","updated_at":"2020-08-24T09:31:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"5adf135a-f469-4618-a999-10ae1658b3ac","html_url":"https://github.com/mtlh/digits0toN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtlh%2Fdigits0toN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtlh%2Fdigits0toN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtlh%2Fdigits0toN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtlh%2Fdigits0toN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtlh","download_url":"https://codeload.github.com/mtlh/digits0toN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240170070,"owners_count":19759140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","coding-challenge","javascript","python"],"created_at":"2024-11-09T04:32:53.135Z","updated_at":"2025-02-22T11:32:11.990Z","avatar_url":"https://github.com/mtlh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# How Many Digits between 1 and N\nhttps://edabit.com/challenge/j9zed4GnykS48W6vh My solution to this problem in Python and JavaScript.\n\n## Python\n\ndef digits(number):\n\tnumber-=1\n\tn = 10**(len(str(number))-1)\n\tdigits = 0\n\twhile n\u003e=1:\n\t\tdigits+=(number-n+1)*len(str(number))\n\t\tnumber=n-1\n\t\tn//=10\n\treturn digits\n  \n  ## JavaScript\n  \n  function digits(number) {\n  if (typeof number === 'bigint') {\n    return bigIntDigits(number)\n  }\n\n\tlet amountOfDigits = 0\n\n  for (let i = 1; i \u003c= number; i *= 10) {\n    amountOfDigits += number - i\n  }\n\n  return amountOfDigits\n}\n\nfunction bigIntDigits(number) {\n  const bigNumber = BigInt(number)\n\tlet amountOfDigits = 0n\n\n  for (let i = 1n; i \u003c= bigNumber; i *= 10n) {\n    amountOfDigits += bigNumber - i\n  }\n\n  return amountOfDigits\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtlh%2Fdigits0ton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtlh%2Fdigits0ton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtlh%2Fdigits0ton/lists"}