current position:Home>Guess the age of American mathematician Wiener
Guess the age of American mathematician Wiener
2022-06-24 07:28:44【Ling Yi】
Title Description
American mathematician Wiener (N.Wiener) Precocious intelligence ,11 I went to college at the age of . He was in 1935~1936 He was invited to give a lecture in Tsinghua University, China . once , He attended some important meeting , Young faces stand out . So someone asked his age , And he said :“ The cube of my age is 4 digit . Of my age 4 The power is a 6 digit . this 10 The number contains exactly from 0 To 9 this 10 A digital , Every one happens to be 1 Time .” Please program the output of Wiener's age in that year .
Ideas
First if...else... sentence , Limit the range of numbers , Age i A bit of the third power of 、 ten 、 Hundred bit 、 Thousands of digits are added to the empty list L1 in , Will age i A bit of the fourth power of 、 ten 、 Hundred bit 、 Thousand bit 、 Ten thousand position 、 Add 100000 digits to the empty list L2 in . Yes L1、L2 Merge the two lists to remove duplicates , Use when removing weight set() obtain L4, Yes L4,L3 Sort sort()( This is the key , Compare dishes stuck in this half day ), Last , contrast L4 Is it equal to L3. Output age i.
L1 = []
L2 = []
L4 = []
L3 = [0,1,2,3,4,5,6,7,8,9]
for i in range(0, 101):
if(i**3>=1000 and i**3<=9999 and i**4>=100000 and i**4<=999999):
L1.append((i**3)%10)
L1.append((i**3)/10%10)
L1.append((i**3)/100%10)
L1.append((i**3)/1000%10)
L2.append((i**4)%10)
L2.append((i**4)/10%10)
L2.append((i**4)/100%10)
L2.append((i**4)/1000%10)
L2.append((i**4)/10000%10)
L2.append((i**4)/100000%10)
L4 = L1 +L2
L4 = list(set(L4))
L4 = L4.sort()
L3 = L3.sort()
if(L4 == L3):
print(i)
break
else:
print(i)
continue
else:
continue
This method is stupid for reference only ( There are good ways to exchange and learn from each other in the comment area Hey, hey, hey )
copyright notice
author[Ling Yi],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/175/202206240202254122.html
The sidebar is recommended
- Python automatic switching environment
- Detailed explanation of python3 rounding problem
- [Master Wu's Python bakery] day 2
- [Master Wu's Python bakery] day 1
- [Master Wu's Python bakery] day 3
- [Master Wu's Python bakery] day 4
- [Master Wu's Python bakery] day 5
- [Master Wu's Python bakery] day 6
- [Master Wu's Python bakery] day 7
- [Master Wu's Python bakery] day 8
guess what you like
Introduction and examples of socket programming in Python
Python notes - permissionerror
Python notes - deprecationwarning
Python notes - Open Python project
Python notes - PIL Library
Python notes - with as statement
How to export IPython history to Py file?
Python multithreading combined with dataloader to load data
Make Python not echo commands that get password input
In c/c++ and python programming, null and none cannot be distinguished clearly
Random recommended
- Writing sample code for functions in Python
- Summary of operation methods of Python set (about 20 operation methods), with sample code attached
- Python -- functions
- Anonymous and recursive functions in Python
- How to query the methods (member functions) of a class or an object in Python [using the function dir()]
- Summary of operation methods of Python Dictionary (dict) (about 18 operation methods), with sample code attached
- Collect hot search lists in Python at work, which can be called a fishing artifact
- Running Django and Vue on docker
- Data classification in pandas
- About Python: docxtpl is embedded by default when inserting pictures
- How to solve the problem of CSV? (Language Python)
- Installation and use of redis (Python)
- Python implements sending mail (implements single / group mail verification code)
- On the built-in object type of Python -- number (one of the differences between py2 and PY3)
- Python God uses a problem to help you solve the problems of formal and actual parameters in Python functions
- "Project Euler Python Mini tutorial" 001-010 solution introduction
- Most beginners learn Python and web automation. In this way, they learn and give up
- Python matrices and numpy arrays
- Exciting challenge: Python crawler crawls the cover picture of station B
- After installing python3, use the yum command to report an error?
- New features of python3.6, 3.7, 3.8 and 3.9
- Application of Python simplehttpserver
- Python sending mail (single / group) - yagmail module
- After learning these English words, mom doesn't have to worry that I can't learn Python any more
- 1-python+ selenium automated test (detailed tutorial) in the series of exercises of "teach you by hand"
- Cannot unmarshal array into go value of type main
- Analysis of the principle of Python import
- Python quickly saves pictures in wechat official account articles (multiple articles can be specified)
- Python error reporting series (14) -- selenium support for phantom JS has been deprecated
- Python variable data type
- Advanced Python Programming - functions and modules
- Python conditional judgment and loop statements
- Python dictionary nesting
- I want to use Python to write a census management software. I want to ask about the ideas and software involved
- I want to use Python to write a census management software. I want to consult the ideas and software involved.
- Python program has no idea
- How to set the initial position of the cursor in Python Tkinter
- The scrapy framework only gets a set of results. I don't know why (Language Python)
- Code problems in Python
- Python automation framework